Reformat CMakeLists.txt files

This commit is contained in:
Janek Bevendorff 2018-10-19 21:41:56 +02:00
parent 0ca7fd369a
commit 77adbef401
13 changed files with 659 additions and 676 deletions

View file

@ -1,4 +1,4 @@
# Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
# Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
# Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
#
# This program is free software: you can redistribute it and/or modify
@ -191,7 +191,7 @@ if(WITH_ASAN)
endif()
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
if (CMAKE_BUILD_TYPE_LOWER MATCHES "(release|relwithdebinfo|minsizerel)")
if(CMAKE_BUILD_TYPE_LOWER MATCHES "(release|relwithdebinfo|minsizerel)")
add_gcc_compiler_flags("-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2")
endif()
@ -211,7 +211,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
if (CMAKE_COMPILER_IS_CLANGXX)
if(CMAKE_COMPILER_IS_CLANGXX)
add_gcc_compiler_flags("-Qunused-arguments")
endif()
add_gcc_compiler_flags("-pie -fPIE")
@ -302,17 +302,14 @@ endif()
include(CLangFormat)
set(QT_COMPONENTS Core Network Concurrent Gui Svg Widgets Test LinguistTools)
if(UNIX AND NOT APPLE)
find_package(Qt5 COMPONENTS Core Network Concurrent Gui Svg Widgets Test LinguistTools DBus REQUIRED)
find_package(Qt5 COMPONENTS ${QT_COMPONENTS} DBus REQUIRED)
elseif(APPLE)
find_package(Qt5 COMPONENTS Core Network Concurrent Gui Svg Widgets Test LinguistTools REQUIRED
HINTS /usr/local/Cellar/qt/*/lib/cmake ENV PATH
)
find_package(Qt5 COMPONENTS MacExtras
HINTS /usr/local/Cellar/qt/*/lib/cmake ENV PATH
)
find_package(Qt5 COMPONENTS ${QT_COMPONENTS} REQUIRED HINTS /usr/local/Cellar/qt/*/lib/cmake ENV PATH)
find_package(Qt5 COMPONENTS MacExtras HINTS /usr/local/Cellar/qt/*/lib/cmake ENV PATH)
else()
find_package(Qt5 COMPONENTS Core Network Concurrent Gui Svg Widgets Test LinguistTools REQUIRED)
find_package(Qt5 COMPONENTS ${QT_COMPONENTS} REQUIRED)
endif()
if(Qt5Core_VERSION VERSION_LESS "5.2.0")

View file

@ -18,8 +18,7 @@ set(EXCLUDED_DIRS
zxcvbn/
streams/QtIOCompressor
# objective-c directories
autotype/mac
)
autotype/mac)
set(EXCLUDED_FILES
# third-party files
@ -36,23 +35,22 @@ set(EXCLUDED_FILES
tests/modeltest.h
# objective-c files
core/ScreenLockListenerMac.h
core/ScreenLockListenerMac.cpp
)
core/ScreenLockListenerMac.cpp)
file(GLOB_RECURSE ALL_SOURCE_FILES *.cpp *.h)
foreach (SOURCE_FILE ${ALL_SOURCE_FILES})
foreach (EXCLUDED_DIR ${EXCLUDED_DIRS})
foreach(SOURCE_FILE ${ALL_SOURCE_FILES})
foreach(EXCLUDED_DIR ${EXCLUDED_DIRS})
string(FIND ${SOURCE_FILE} ${EXCLUDED_DIR} SOURCE_FILE_EXCLUDED)
if (NOT ${SOURCE_FILE_EXCLUDED} EQUAL -1)
if(NOT ${SOURCE_FILE_EXCLUDED} EQUAL -1)
list(REMOVE_ITEM ALL_SOURCE_FILES ${SOURCE_FILE})
endif ()
endforeach ()
foreach (EXCLUDED_FILE ${EXCLUDED_FILES})
if (${SOURCE_FILE} MATCHES ".*${EXCLUDED_FILE}$")
endif()
endforeach()
foreach(EXCLUDED_FILE ${EXCLUDED_FILES})
if(${SOURCE_FILE} MATCHES ".*${EXCLUDED_FILE}$")
list(REMOVE_ITEM ALL_SOURCE_FILES ${SOURCE_FILE})
endif ()
endforeach ()
endforeach ()
endif()
endforeach()
endforeach()
add_custom_target(
format

View file

@ -14,7 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
find_path(ARGON2_INCLUDE_DIR argon2.h)
if (MINGW)
if(MINGW)
# find static library on Windows, and redefine used symbols to
# avoid definition name conflicts with libsodium
find_library(ARGON2_SYS_LIBRARIES libargon2.a)

View file

@ -1,4 +1,4 @@
# Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
# Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
# Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
#
# This program is free software: you can redistribute it and/or modify
@ -22,7 +22,7 @@ include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_HEAD)
git_describe(GIT_DESCRIBE --long)
if (NOT GIT_HEAD OR NOT GIT_DESCRIBE)
if(NOT GIT_HEAD OR NOT GIT_DESCRIBE)
set(GIT_HEAD "")
set(GIT_DESCRIBE "")
endif()
@ -185,30 +185,28 @@ set(keepassx_SOURCES
totp/totp.h
totp/totp.cpp)
if(APPLE)
set(keepassx_SOURCES ${keepassx_SOURCES}
set(keepassx_SOURCES
${keepassx_SOURCES}
core/ScreenLockListenerMac.h
core/ScreenLockListenerMac.cpp
core/MacPasteboard.h
core/MacPasteboard.cpp
)
core/MacPasteboard.cpp)
endif()
if(UNIX AND NOT APPLE)
set(keepassx_SOURCES ${keepassx_SOURCES}
set(keepassx_SOURCES
${keepassx_SOURCES}
core/ScreenLockListenerDBus.h
core/ScreenLockListenerDBus.cpp
gui/MainWindowAdaptor.cpp
)
gui/MainWindowAdaptor.cpp)
endif()
if(MINGW)
set(keepassx_SOURCES ${keepassx_SOURCES}
set(keepassx_SOURCES
${keepassx_SOURCES}
core/ScreenLockListenerWin.h
core/ScreenLockListenerWin.cpp
)
core/ScreenLockListenerWin.cpp)
endif()
set(keepassx_SOURCES_MAINEXE
main.cpp
)
set(keepassx_SOURCES_MAINEXE main.cpp)
add_feature_info(Auto-Type WITH_XC_AUTOTYPE "Automatic password typing")
add_feature_info(Networking WITH_XC_NETWORKING "Compile KeePassXC with network access code (e.g. for downloading website icons)")
@ -246,13 +244,10 @@ set(autotype_SOURCES
autotype/ShortcutWidget.cpp
autotype/WildcardMatcher.cpp
autotype/WindowSelectComboBox.cpp
autotype/test/AutoTypeTestInterface.h
)
autotype/test/AutoTypeTestInterface.h)
if(MINGW)
set(keepassx_SOURCES_MAINEXE
${keepassx_SOURCES_MAINEXE}
${CMAKE_SOURCE_DIR}/share/windows/icon.rc)
set(keepassx_SOURCES_MAINEXE ${keepassx_SOURCES_MAINEXE} ${CMAKE_SOURCE_DIR}/share/windows/icon.rc)
endif()
if(WITH_XC_YUBIKEY)
@ -300,7 +295,7 @@ if(APPLE)
target_link_libraries(keepassx_core "-framework LocalAuthentication")
endif()
endif()
if (UNIX AND NOT APPLE)
if(UNIX AND NOT APPLE)
target_link_libraries(keepassx_core Qt5::DBus)
endif()
if(MINGW)
@ -332,7 +327,7 @@ if(APPLE AND WITH_APP_BUNDLE)
if(WITH_XC_TOUCHID)
set_target_properties(${PROGNAME} PROPERTIES
CPACK_BUNDLE_APPLE_ENTITLEMENTS "${CMAKE_SOURCE_DIR}/share/macosx/keepassxc.entitlements" )
CPACK_BUNDLE_APPLE_ENTITLEMENTS "${CMAKE_SOURCE_DIR}/share/macosx/keepassxc.entitlements")
endif()
if(QT_MAC_USE_COCOA AND EXISTS "${QT_LIBRARY_DIR}/Resources/qt_menu.nib")

View file

@ -1,10 +1,6 @@
set(autotype_mac_SOURCES
AutoTypeMac.cpp
)
set(autotype_mac_SOURCES AutoTypeMac.cpp)
set(autotype_mac_mm_SOURCES
AppKitImpl.mm
)
set(autotype_mac_mm_SOURCES AppKitImpl.mm)
add_library(keepassx-autotype-cocoa MODULE ${autotype_mac_SOURCES} ${autotype_mac_mm_SOURCES})
set_target_properties(keepassx-autotype-cocoa PROPERTIES LINK_FLAGS "-framework Foundation -framework AppKit -framework Carbon")

View file

@ -1,6 +1,4 @@
set(autotype_test_SOURCES
AutoTypeTest.cpp
)
set(autotype_test_SOURCES AutoTypeTest.cpp)
add_library(keepassx-autotype-test MODULE ${autotype_test_SOURCES})
target_link_libraries(keepassx-autotype-test keepassx_core ${autotype_LIB} Qt5::Core Qt5::Widgets)

View file

@ -1,9 +1,7 @@
set(autotype_win_SOURCES
AutoTypeWindows.cpp
)
set(autotype_win_SOURCES AutoTypeWindows.cpp)
add_library(keepassx-autotype-windows MODULE ${autotype_win_SOURCES})
target_link_libraries(keepassx-autotype-windows keepassx_core ${autotype_LIB} Qt5::Core Qt5::Widgets)
install(TARGETS keepassx-autotype-windows
BUNDLE DESTINATION . COMPONENT Runtime
LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR} COMPONENT Runtime)
LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR} COMPONENT Runtime)

View file

@ -1,8 +1,6 @@
include_directories(SYSTEM ${X11_X11_INCLUDE_PATH})
set(autotype_XCB_SOURCES
AutoTypeXCB.cpp
)
set(autotype_XCB_SOURCES AutoTypeXCB.cpp)
add_library(keepassx-autotype-xcb MODULE ${autotype_XCB_SOURCES})
target_link_libraries(keepassx-autotype-xcb keepassx_core Qt5::Core Qt5::Widgets Qt5::X11Extras ${X11_X11_LIB} ${X11_Xi_LIB} ${X11_XTest_LIB})

View file

@ -30,8 +30,7 @@ if(WITH_XC_BROWSER)
HostInstaller.cpp
NativeMessagingBase.cpp
NativeMessagingHost.cpp
Variant.cpp
)
Variant.cpp)
add_library(keepassxcbrowser STATIC ${keepassxcbrowser_SOURCES})
target_link_libraries(keepassxcbrowser Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network sodium)

View file

@ -1,3 +1,4 @@
# Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
# Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
#
# This program is free software: you can redistribute it and/or modify
@ -13,7 +14,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/../src)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}/../src)
add_definitions(-DQT_TEST_LIB)
@ -92,8 +97,7 @@ set(TEST_LIBRARIES
Qt5::Test
${GCRYPT_LIBRARIES}
${GPGERROR_LIBRARIES}
${ZLIB_LIBRARIES}
)
${ZLIB_LIBRARIES})
set(testsupport_SOURCES TestGlobal.h modeltest.cpp FailDevice.cpp mock/MockClock.cpp util/TemporaryFile.cpp)
add_library(testsupport STATIC ${testsupport_SOURCES})
@ -183,7 +187,7 @@ add_unit_test(NAME testrandom SOURCES TestRandom.cpp
add_unit_test(NAME testentrysearcher SOURCES TestEntrySearcher.cpp
LIBS ${TEST_LIBRARIES})
add_unit_test(NAME testcsveporter SOURCES TestCsvExporter.cpp
add_unit_test(NAME testcsvexporter SOURCES TestCsvExporter.cpp
LIBS ${TEST_LIBRARIES})
add_unit_test(NAME testykchallengeresponsekey