mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Fix cmake file formatting.
This commit is contained in:
parent
76eb935024
commit
a1a71a88bb
@ -17,7 +17,7 @@ project(KeePassX)
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 2.6.4)
|
cmake_minimum_required(VERSION 2.6.4)
|
||||||
|
|
||||||
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||||
|
|
||||||
include(CheckCCompilerFlag)
|
include(CheckCCompilerFlag)
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
@ -28,27 +28,27 @@ option(WITH_GUI_TESTS "Enable building of GUI tests" OFF)
|
|||||||
option(WITH_LTO "Enable Link Time Optimization (LTO)" OFF)
|
option(WITH_LTO "Enable Link Time Optimization (LTO)" OFF)
|
||||||
option(WITH_PIE "Build as Position-independent executable (PIE)" OFF)
|
option(WITH_PIE "Build as Position-independent executable (PIE)" OFF)
|
||||||
|
|
||||||
set( KEEPASSX_VERSION "2.0 alpha 1" )
|
set(KEEPASSX_VERSION "2.0 alpha 1")
|
||||||
set( KEEPASSX_VERSION_NUM "1.9.80" )
|
set(KEEPASSX_VERSION_NUM "1.9.80")
|
||||||
|
|
||||||
if("${CMAKE_C_COMPILER}" MATCHES "clang$" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
|
if("${CMAKE_C_COMPILER}" MATCHES "clang$" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
|
||||||
set(CMAKE_COMPILER_IS_CLANG 1)
|
set(CMAKE_COMPILER_IS_CLANG 1)
|
||||||
endif("${CMAKE_C_COMPILER}" MATCHES "clang$" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
|
endif()
|
||||||
|
|
||||||
if("${CMAKE_CXX_COMPILER}" MATCHES "clang(\\+\\+)?$" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
if("${CMAKE_CXX_COMPILER}" MATCHES "clang(\\+\\+)?$" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
set(CMAKE_COMPILER_IS_CLANGXX 1)
|
set(CMAKE_COMPILER_IS_CLANGXX 1)
|
||||||
endif("${CMAKE_CXX_COMPILER}" MATCHES "clang(\\+\\+)?$" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
endif()
|
||||||
|
|
||||||
macro(add_gcc_compiler_cxxflags FLAGS)
|
macro(add_gcc_compiler_cxxflags FLAGS)
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
|
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}")
|
||||||
endif(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
|
endif()
|
||||||
endmacro(add_gcc_compiler_cxxflags)
|
endmacro(add_gcc_compiler_cxxflags)
|
||||||
|
|
||||||
macro(add_gcc_compiler_cflags FLAGS)
|
macro(add_gcc_compiler_cflags FLAGS)
|
||||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}")
|
||||||
endif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
|
endif()
|
||||||
endmacro(add_gcc_compiler_cflags)
|
endmacro(add_gcc_compiler_cflags)
|
||||||
|
|
||||||
macro(add_gcc_compiler_flags FLAGS)
|
macro(add_gcc_compiler_flags FLAGS)
|
||||||
@ -77,18 +77,18 @@ if(CMAKE_COMPILER_IS_CLANGXX)
|
|||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mllvm -stack-protector-buffer-size=4")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mllvm -stack-protector-buffer-size=4")
|
||||||
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wcast-align --param=ssp-buffer-size=4")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wcast-align --param=ssp-buffer-size=4")
|
||||||
endif(CMAKE_COMPILER_IS_CLANGXX)
|
endif()
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_CLANG)
|
if(CMAKE_COMPILER_IS_CLANG)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mllvm -stack-protector-buffer-size=4")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mllvm -stack-protector-buffer-size=4")
|
||||||
elseif(CMAKE_COMPILER_IS_GNUCC)
|
elseif(CMAKE_COMPILER_IS_GNUCC)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wcast-align --param=ssp-buffer-size=4")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wcast-align --param=ssp-buffer-size=4")
|
||||||
endif(CMAKE_COMPILER_IS_CLANG)
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-add-needed -Wl,--as-needed -Wl,--no-undefined")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-add-needed -Wl,--as-needed -Wl,--no-undefined")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro")
|
||||||
endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
endif()
|
||||||
|
|
||||||
if(WITH_LTO)
|
if(WITH_LTO)
|
||||||
if(CMAKE_COMPILER_IS_GNUCC and CMAKE_COMPILER_IS_GNUCXX)
|
if(CMAKE_COMPILER_IS_GNUCC and CMAKE_COMPILER_IS_GNUCXX)
|
||||||
@ -102,7 +102,7 @@ if(WITH_LTO)
|
|||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "LTO is only supported with gcc")
|
message(FATAL_ERROR "LTO is only supported with gcc")
|
||||||
endif(CMAKE_COMPILER_IS_GNUCC and CMAKE_COMPILER_IS_GNUCXX)
|
endif(CMAKE_COMPILER_IS_GNUCC and CMAKE_COMPILER_IS_GNUCXX)
|
||||||
endif(WITH_LTO)
|
endif()
|
||||||
|
|
||||||
if(WITH_PIE)
|
if(WITH_PIE)
|
||||||
if((CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) AND (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX))
|
if((CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) AND (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX))
|
||||||
@ -110,33 +110,33 @@ if(WITH_PIE)
|
|||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIE -pie")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIE -pie")
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "PIE is only supported with gcc and clang")
|
message(FATAL_ERROR "PIE is only supported with gcc and clang")
|
||||||
endif((CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) AND (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX))
|
endif()
|
||||||
endif(WITH_PIE)
|
endif()
|
||||||
|
|
||||||
if( APPLE OR MINGW )
|
if(APPLE OR MINGW)
|
||||||
set( PROGNAME KeePassX )
|
set(PROGNAME KeePassX)
|
||||||
else( APPLE OR MINGW )
|
else()
|
||||||
set( PROGNAME keepassx )
|
set(PROGNAME keepassx)
|
||||||
endif( APPLE OR MINGW )
|
endif()
|
||||||
|
|
||||||
if(APPLE AND "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local")
|
if(APPLE AND "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local")
|
||||||
set(CMAKE_INSTALL_PREFIX "/Applications")
|
set(CMAKE_INSTALL_PREFIX "/Applications")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MINGW)
|
if(MINGW)
|
||||||
set(BIN_INSTALL_DIR "")
|
set(BIN_INSTALL_DIR "")
|
||||||
set(DATA_INSTALL_DIR "share")
|
set(DATA_INSTALL_DIR "share")
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
set(BIN_INSTALL_DIR "")
|
set(BIN_INSTALL_DIR "")
|
||||||
set(DATA_INSTALL_DIR "${PROGNAME}.app/Contents/Resources")
|
set(DATA_INSTALL_DIR "${PROGNAME}.app/Contents/Resources")
|
||||||
else(MINGW)
|
else()
|
||||||
set(BIN_INSTALL_DIR "bin")
|
set(BIN_INSTALL_DIR "bin")
|
||||||
set(DATA_INSTALL_DIR "share/keepassx")
|
set(DATA_INSTALL_DIR "share/keepassx")
|
||||||
endif( MINGW )
|
endif()
|
||||||
|
|
||||||
if( WITH_TESTS )
|
if(WITH_TESTS)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
endif( WITH_TESTS )
|
endif(WITH_TESTS)
|
||||||
|
|
||||||
find_package(Qt4 4.6.0 REQUIRED QtCore QtGui QtTest)
|
find_package(Qt4 4.6.0 REQUIRED QtCore QtGui QtTest)
|
||||||
add_definitions(${QT_DEFINITIONS} -DQT_CORE_LIB -DQT_GUI_LIB)
|
add_definitions(${QT_DEFINITIONS} -DQT_CORE_LIB -DQT_GUI_LIB)
|
||||||
@ -144,32 +144,32 @@ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG QT_DEBUG)
|
|||||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG)
|
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG)
|
||||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO QT_NO_DEBUG)
|
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO QT_NO_DEBUG)
|
||||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG)
|
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG)
|
||||||
IF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
|
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
|
||||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_DEBUG)
|
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_DEBUG)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
find_package(Gcrypt REQUIRED)
|
find_package(Gcrypt REQUIRED)
|
||||||
|
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
|
|
||||||
check_cxx_source_compiles("
|
check_cxx_source_compiles("
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
#if !defined(ZLIB_VERNUM) || (ZLIB_VERNUM < 0x1200)
|
#if !defined(ZLIB_VERNUM) || (ZLIB_VERNUM < 0x1200)
|
||||||
#error zlib 1.2.x or higher is required to use the gzip format
|
#error zlib 1.2.x or higher is required to use the gzip format
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main() { return 0; }" ZLIB_SUPPORTS_GZIP)
|
int main() { return 0; }" ZLIB_SUPPORTS_GZIP)
|
||||||
|
|
||||||
if(NOT ZLIB_SUPPORTS_GZIP)
|
if(NOT ZLIB_SUPPORTS_GZIP)
|
||||||
message(FATAL_ERROR "zlib 1.2.x or higher is required to use the gzip format")
|
message(FATAL_ERROR "zlib 1.2.x or higher is required to use the gzip format")
|
||||||
endif(NOT ZLIB_SUPPORTS_GZIP)
|
endif()
|
||||||
|
|
||||||
include_directories(SYSTEM ${QT_INCLUDE_DIR} ${GCRYPT_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
|
include_directories(SYSTEM ${QT_INCLUDE_DIR} ${GCRYPT_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
add_subdirectory(share)
|
add_subdirectory(share)
|
||||||
add_subdirectory(utils)
|
add_subdirectory(utils)
|
||||||
if( WITH_TESTS )
|
if(WITH_TESTS)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif( WITH_TESTS )
|
endif(WITH_TESTS)
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
configure_file( config-keepassx.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-keepassx.h )
|
configure_file(config-keepassx.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-keepassx.h)
|
||||||
|
|
||||||
set(keepassx_SOURCES
|
set(keepassx_SOURCES
|
||||||
core/Config.cpp
|
core/Config.cpp
|
||||||
@ -144,10 +144,15 @@ set(keepassx_FORMS
|
|||||||
qt4_wrap_ui(keepassx_SOURCES ${keepassx_FORMS})
|
qt4_wrap_ui(keepassx_SOURCES ${keepassx_FORMS})
|
||||||
qt4_wrap_cpp(keepassx_SOURCES ${keepassx_MOC})
|
qt4_wrap_cpp(keepassx_SOURCES ${keepassx_MOC})
|
||||||
|
|
||||||
add_library( keepassx_core STATIC ${keepassx_SOURCES} )
|
add_library(keepassx_core STATIC ${keepassx_SOURCES})
|
||||||
|
|
||||||
add_executable( ${PROGNAME} WIN32 MACOSX_BUNDLE main.cpp )
|
add_executable(${PROGNAME} WIN32 MACOSX_BUNDLE main.cpp)
|
||||||
target_link_libraries( ${PROGNAME} keepassx_core ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${GCRYPT_LIBRARIES} ${ZLIB_LIBRARIES} )
|
target_link_libraries(${PROGNAME}
|
||||||
|
keepassx_core
|
||||||
|
${QT_QTCORE_LIBRARY}
|
||||||
|
${QT_QTGUI_LIBRARY}
|
||||||
|
${GCRYPT_LIBRARIES}
|
||||||
|
${ZLIB_LIBRARIES})
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/share/macosx/Info.plist.cmake ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
|
configure_file(${CMAKE_SOURCE_DIR}/share/macosx/Info.plist.cmake ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
|
||||||
@ -156,8 +161,8 @@ if(APPLE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(TARGETS ${PROGNAME}
|
install(TARGETS ${PROGNAME}
|
||||||
BUNDLE DESTINATION . COMPONENT Runtime
|
BUNDLE DESTINATION . COMPONENT Runtime
|
||||||
RUNTIME DESTINATION ${BIN_INSTALL_DIR} COMPONENT Runtime)
|
RUNTIME DESTINATION ${BIN_INSTALL_DIR} COMPONENT Runtime)
|
||||||
|
|
||||||
if(APPLE AND NOT (${CMAKE_VERSION} VERSION_LESS 2.8.8))
|
if(APPLE AND NOT (${CMAKE_VERSION} VERSION_LESS 2.8.8))
|
||||||
if(QT_MAC_USE_COCOA AND EXISTS "${QT_LIBRARY_DIR}/Resources/qt_menu.nib")
|
if(QT_MAC_USE_COCOA AND EXISTS "${QT_LIBRARY_DIR}/Resources/qt_menu.nib")
|
||||||
|
@ -13,79 +13,78 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
|
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/src)
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/src)
|
||||||
|
|
||||||
add_definitions(-DQT_TEST_LIB)
|
add_definitions(-DQT_TEST_LIB)
|
||||||
|
|
||||||
set( KEEPASSX_TEST_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data )
|
set(KEEPASSX_TEST_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data)
|
||||||
configure_file( config-keepassx-tests.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-keepassx-tests.h )
|
configure_file(config-keepassx-tests.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-keepassx-tests.h)
|
||||||
|
|
||||||
MACRO(PARSE_ARGUMENTS prefix arg_names option_names)
|
macro(parse_arguments prefix arg_names option_names)
|
||||||
SET(DEFAULT_ARGS)
|
set(DEFAULT_ARGS)
|
||||||
FOREACH(arg_name ${arg_names})
|
foreach(arg_name ${arg_names})
|
||||||
SET(${prefix}_${arg_name})
|
set(${prefix}_${arg_name})
|
||||||
ENDFOREACH(arg_name)
|
endforeach(arg_name)
|
||||||
FOREACH(option ${option_names})
|
foreach(option ${option_names})
|
||||||
SET(${prefix}_${option} FALSE)
|
set(${prefix}_${option} FALSE)
|
||||||
ENDFOREACH(option)
|
endforeach(option)
|
||||||
|
|
||||||
SET(current_arg_name DEFAULT_ARGS)
|
set(current_arg_name DEFAULT_ARGS)
|
||||||
SET(current_arg_list)
|
set(current_arg_list)
|
||||||
FOREACH(arg ${ARGN})
|
foreach(arg ${ARGN})
|
||||||
SET(larg_names ${arg_names})
|
set(larg_names ${arg_names})
|
||||||
LIST(FIND larg_names "${arg}" is_arg_name)
|
list(FIND larg_names "${arg}" is_arg_name)
|
||||||
IF (is_arg_name GREATER -1)
|
if(is_arg_name GREATER -1)
|
||||||
SET(${prefix}_${current_arg_name} ${current_arg_list})
|
set(${prefix}_${current_arg_name} ${current_arg_list})
|
||||||
SET(current_arg_name ${arg})
|
set(current_arg_name ${arg})
|
||||||
SET(current_arg_list)
|
set(current_arg_list)
|
||||||
ELSE (is_arg_name GREATER -1)
|
else()
|
||||||
SET(loption_names ${option_names})
|
set(loption_names ${option_names})
|
||||||
LIST(FIND loption_names "${arg}" is_option)
|
list(FIND loption_names "${arg}" is_option)
|
||||||
IF (is_option GREATER -1)
|
if(is_option GREATER -1)
|
||||||
SET(${prefix}_${arg} TRUE)
|
set(${prefix}_${arg} TRUE)
|
||||||
ELSE (is_option GREATER -1)
|
else(is_option GREATER -1)
|
||||||
SET(current_arg_list ${current_arg_list} ${arg})
|
set(current_arg_list ${current_arg_list} ${arg})
|
||||||
ENDIF (is_option GREATER -1)
|
endif()
|
||||||
ENDIF (is_arg_name GREATER -1)
|
endif()
|
||||||
ENDFOREACH(arg)
|
endforeach(arg)
|
||||||
SET(${prefix}_${current_arg_name} ${current_arg_list})
|
set(${prefix}_${current_arg_name} ${current_arg_list})
|
||||||
ENDMACRO(PARSE_ARGUMENTS)
|
endmacro(parse_arguments)
|
||||||
|
|
||||||
macro (ADD_UNIT_TEST)
|
macro(add_unit_test)
|
||||||
parse_arguments( TEST "NAME;SOURCES;MOCS;LIBS" "" ${ARGN} )
|
parse_arguments(TEST "NAME;SOURCES;MOCS;LIBS" "" ${ARGN})
|
||||||
set(_test_NAME ${TEST_NAME})
|
set(_test_NAME ${TEST_NAME})
|
||||||
set(_srcList ${TEST_SOURCES})
|
set(_srcList ${TEST_SOURCES})
|
||||||
qt4_wrap_cpp( _srcList ${TEST_MOCS} )
|
qt4_wrap_cpp(_srcList ${TEST_MOCS})
|
||||||
add_executable( ${_test_NAME} ${_srcList} )
|
add_executable(${_test_NAME} ${_srcList})
|
||||||
target_link_libraries( ${_test_NAME} ${TEST_LIBS} )
|
target_link_libraries(${_test_NAME} ${TEST_LIBS})
|
||||||
|
|
||||||
if(NOT TEST_OUTPUT)
|
if(NOT TEST_OUTPUT)
|
||||||
set(TEST_OUTPUT plaintext)
|
set(TEST_OUTPUT plaintext)
|
||||||
endif(NOT TEST_OUTPUT)
|
endif(NOT TEST_OUTPUT)
|
||||||
set(TEST_OUTPUT ${TEST_OUTPUT} CACHE STRING "The output to generate when running the QTest unit tests")
|
set(TEST_OUTPUT ${TEST_OUTPUT} CACHE STRING "The output to generate when running the QTest unit tests")
|
||||||
|
|
||||||
get_target_property( loc ${_test_NAME} LOCATION )
|
get_target_property(loc ${_test_NAME} LOCATION)
|
||||||
|
|
||||||
if (KDE4_TEST_OUTPUT STREQUAL "xml")
|
if(KDE4_TEST_OUTPUT STREQUAL "xml")
|
||||||
add_test( ${_test_NAME} ${loc} -xml -o ${_test_NAME}.tml)
|
add_test(${_test_NAME} ${loc} -xml -o ${_test_NAME}.tml)
|
||||||
else (KDE4_TEST_OUTPUT STREQUAL "xml")
|
else(KDE4_TEST_OUTPUT STREQUAL "xml")
|
||||||
add_test( ${_test_NAME} ${loc} )
|
add_test(${_test_NAME} ${loc})
|
||||||
endif (KDE4_TEST_OUTPUT STREQUAL "xml")
|
endif(KDE4_TEST_OUTPUT STREQUAL "xml")
|
||||||
|
|
||||||
if (NOT MSVC_IDE) #not needed for the ide
|
if(NOT MSVC_IDE) #not needed for the ide
|
||||||
# if the tests are EXCLUDE_FROM_ALL, add a target "buildtests" to build all tests
|
# if the tests are EXCLUDE_FROM_ALL, add a target "buildtests" to build all tests
|
||||||
if (NOT WITH_TESTS)
|
if(NOT WITH_TESTS)
|
||||||
get_directory_property(_buildtestsAdded BUILDTESTS_ADDED)
|
get_directory_property(_buildtestsAdded BUILDTESTS_ADDED)
|
||||||
if(NOT _buildtestsAdded)
|
if(NOT _buildtestsAdded)
|
||||||
add_custom_target(buildtests)
|
add_custom_target(buildtests)
|
||||||
set_directory_properties(PROPERTIES BUILDTESTS_ADDED TRUE)
|
set_directory_properties(PROPERTIES BUILDTESTS_ADDED TRUE)
|
||||||
endif(NOT _buildtestsAdded)
|
endif()
|
||||||
add_dependencies(buildtests ${_test_NAME})
|
add_dependencies(buildtests ${_test_NAME})
|
||||||
endif (NOT WITH_TESTS)
|
endif()
|
||||||
endif (NOT MSVC_IDE)
|
endif()
|
||||||
|
endmacro(add_unit_test)
|
||||||
endmacro (ADD_UNIT_TEST)
|
|
||||||
|
|
||||||
|
|
||||||
set(TEST_LIBRARIES
|
set(TEST_LIBRARIES
|
||||||
@ -98,37 +97,51 @@ set(TEST_LIBRARIES
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(modeltest_SOURCRS modeltest.cpp)
|
set(modeltest_SOURCRS modeltest.cpp)
|
||||||
qt4_wrap_cpp( modeltest_SOURCRS modeltest.h )
|
qt4_wrap_cpp(modeltest_SOURCRS modeltest.h)
|
||||||
add_library( modeltest STATIC ${modeltest_SOURCRS} )
|
add_library(modeltest STATIC ${modeltest_SOURCRS})
|
||||||
|
|
||||||
add_unit_test(NAME testgroup SOURCES TestGroup.cpp MOCS TestGroup.h LIBS ${TEST_LIBRARIES} )
|
add_unit_test(NAME testgroup SOURCES TestGroup.cpp MOCS TestGroup.h
|
||||||
|
LIBS ${TEST_LIBRARIES})
|
||||||
|
|
||||||
add_unit_test(NAME testkeepass2xmlreader SOURCES TestKeePass2XmlReader.cpp MOCS TestKeePass2XmlReader.h LIBS ${TEST_LIBRARIES})
|
add_unit_test(NAME testkeepass2xmlreader SOURCES TestKeePass2XmlReader.cpp MOCS TestKeePass2XmlReader.h
|
||||||
|
LIBS ${TEST_LIBRARIES})
|
||||||
|
|
||||||
add_unit_test(NAME testkeys SOURCES TestKeys.cpp MOCS TestKeys.h LIBS ${TEST_LIBRARIES})
|
add_unit_test(NAME testkeys SOURCES TestKeys.cpp MOCS TestKeys.h
|
||||||
|
LIBS ${TEST_LIBRARIES})
|
||||||
|
|
||||||
add_unit_test(NAME testkeepass2reader SOURCES TestKeePass2Reader.cpp MOCS TestKeePass2Reader.h LIBS ${TEST_LIBRARIES})
|
add_unit_test(NAME testkeepass2reader SOURCES TestKeePass2Reader.cpp MOCS TestKeePass2Reader.h
|
||||||
|
LIBS ${TEST_LIBRARIES})
|
||||||
|
|
||||||
add_unit_test(NAME testkeepass2writer SOURCES TestKeePass2Writer.cpp MOCS TestKeePass2Writer.h LIBS ${TEST_LIBRARIES})
|
add_unit_test(NAME testkeepass2writer SOURCES TestKeePass2Writer.cpp MOCS TestKeePass2Writer.h
|
||||||
|
LIBS ${TEST_LIBRARIES})
|
||||||
|
|
||||||
add_unit_test(NAME testgroupmodel SOURCES TestGroupModel.cpp MOCS TestGroupModel.h LIBS ${TEST_LIBRARIES} modeltest)
|
add_unit_test(NAME testgroupmodel SOURCES TestGroupModel.cpp MOCS TestGroupModel.h
|
||||||
|
LIBS ${TEST_LIBRARIES} modeltest)
|
||||||
|
|
||||||
add_unit_test(NAME testentrymodel SOURCES TestEntryModel.cpp MOCS TestEntryModel.h LIBS ${TEST_LIBRARIES} modeltest)
|
add_unit_test(NAME testentrymodel SOURCES TestEntryModel.cpp MOCS TestEntryModel.h
|
||||||
|
LIBS ${TEST_LIBRARIES} modeltest)
|
||||||
|
|
||||||
add_unit_test(NAME testcryptohash SOURCES TestCryptoHash.cpp MOCS TestCryptoHash.h LIBS ${TEST_LIBRARIES})
|
add_unit_test(NAME testcryptohash SOURCES TestCryptoHash.cpp MOCS TestCryptoHash.h
|
||||||
|
LIBS ${TEST_LIBRARIES})
|
||||||
|
|
||||||
add_unit_test(NAME testsymmetriccipher SOURCES TestSymmetricCipher.cpp MOCS TestSymmetricCipher.h LIBS ${TEST_LIBRARIES})
|
add_unit_test(NAME testsymmetriccipher SOURCES TestSymmetricCipher.cpp MOCS TestSymmetricCipher.h
|
||||||
|
LIBS ${TEST_LIBRARIES})
|
||||||
|
|
||||||
add_unit_test(NAME testhashedblockstream SOURCES TestHashedBlockStream.cpp MOCS TestHashedBlockStream.h LIBS ${TEST_LIBRARIES})
|
add_unit_test(NAME testhashedblockstream SOURCES TestHashedBlockStream.cpp MOCS TestHashedBlockStream.h
|
||||||
|
LIBS ${TEST_LIBRARIES})
|
||||||
|
|
||||||
add_unit_test(NAME testkeepass2randomstream SOURCES TestKeePass2RandomStream.cpp MOCS TestKeePass2RandomStream.h LIBS ${TEST_LIBRARIES})
|
add_unit_test(NAME testkeepass2randomstream SOURCES TestKeePass2RandomStream.cpp MOCS TestKeePass2RandomStream.h
|
||||||
|
LIBS ${TEST_LIBRARIES})
|
||||||
|
|
||||||
add_unit_test(NAME testmodified SOURCES TestModified.cpp MOCS TestModified.h LIBS ${TEST_LIBRARIES})
|
add_unit_test(NAME testmodified SOURCES TestModified.cpp MOCS TestModified.h
|
||||||
|
LIBS ${TEST_LIBRARIES})
|
||||||
|
|
||||||
add_unit_test(NAME testdeletedobjects SOURCES TestDeletedObjects.cpp MOCS TestDeletedObjects.h LIBS ${TEST_LIBRARIES})
|
add_unit_test(NAME testdeletedobjects SOURCES TestDeletedObjects.cpp MOCS TestDeletedObjects.h
|
||||||
|
LIBS ${TEST_LIBRARIES})
|
||||||
|
|
||||||
add_unit_test(NAME testkeepass1reader SOURCES TestKeePass1Reader.cpp MOCS TestKeePass1Reader.h LIBS ${TEST_LIBRARIES})
|
add_unit_test(NAME testkeepass1reader SOURCES TestKeePass1Reader.cpp MOCS TestKeePass1Reader.h
|
||||||
|
LIBS ${TEST_LIBRARIES})
|
||||||
|
|
||||||
if(WITH_GUI_TESTS)
|
if(WITH_GUI_TESTS)
|
||||||
add_subdirectory(gui)
|
add_subdirectory(gui)
|
||||||
endif(WITH_GUI_TESTS)
|
endif(WITH_GUI_TESTS)
|
||||||
|
@ -15,5 +15,10 @@
|
|||||||
|
|
||||||
include_directories(../src)
|
include_directories(../src)
|
||||||
|
|
||||||
add_executable( kdbx-extract kdbx-extract.cpp )
|
add_executable(kdbx-extract kdbx-extract.cpp)
|
||||||
target_link_libraries( kdbx-extract keepassx_core ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${GCRYPT_LIBRARIES} ${ZLIB_LIBRARIES} )
|
target_link_libraries(kdbx-extract
|
||||||
|
keepassx_core
|
||||||
|
${QT_QTCORE_LIBRARY}
|
||||||
|
${QT_QTGUI_LIBRARY}
|
||||||
|
${GCRYPT_LIBRARIES}
|
||||||
|
${ZLIB_LIBRARIES})
|
||||||
|
Loading…
Reference in New Issue
Block a user