Skip to content

Commit

Permalink
Reformat CMakeLists.txt files
Browse files Browse the repository at this point in the history
  • Loading branch information
phoerious committed Oct 19, 2018
1 parent 0ca7fd3 commit 77adbef
Show file tree
Hide file tree
Showing 13 changed files with 671 additions and 688 deletions.
287 changes: 142 additions & 145 deletions CMakeLists.txt

Large diffs are not rendered by default.

62 changes: 30 additions & 32 deletions cmake/CLangFormat.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,45 +14,43 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

set(EXCLUDED_DIRS
# third-party directories
zxcvbn/
streams/QtIOCompressor
# objective-c directories
autotype/mac
)
# third-party directories
zxcvbn/
streams/QtIOCompressor
# objective-c directories
autotype/mac)

set(EXCLUDED_FILES
# third-party files
streams/qtiocompressor.cpp
streams/qtiocompressor.h
gui/KMessageWidget.h
gui/KMessageWidget.cpp
gui/MainWindowAdaptor.h
gui/MainWindowAdaptor.cpp
sshagent/bcrypt_pbkdf.cpp
sshagent/blf.h
sshagent/blowfish.c
tests/modeltest.cpp
tests/modeltest.h
# objective-c files
core/ScreenLockListenerMac.h
core/ScreenLockListenerMac.cpp
)
# third-party files
streams/qtiocompressor.cpp
streams/qtiocompressor.h
gui/KMessageWidget.h
gui/KMessageWidget.cpp
gui/MainWindowAdaptor.h
gui/MainWindowAdaptor.cpp
sshagent/bcrypt_pbkdf.cpp
sshagent/blf.h
sshagent/blowfish.c
tests/modeltest.cpp
tests/modeltest.h
# objective-c files
core/ScreenLockListenerMac.h
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
Expand Down
28 changes: 14 additions & 14 deletions cmake/FindArgon2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

find_path(ARGON2_INCLUDE_DIR argon2.h)
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)
message(STATUS "Patching libargon2...\n")
execute_process(COMMAND objcopy
--redefine-sym argon2_hash=libargon2_argon2_hash
--redefine-sym _argon2_hash=_libargon2_argon2_hash
--redefine-sym argon2_error_message=libargon2_argon2_error_message
--redefine-sym _argon2_error_message=_libargon2_argon2_error_message
${ARGON2_SYS_LIBRARIES} ${CMAKE_BINARY_DIR}/libargon2_patched.a
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
find_library(ARGON2_LIBRARIES libargon2_patched.a PATHS ${CMAKE_BINARY_DIR} NO_DEFAULT_PATH)
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)
message(STATUS "Patching libargon2...\n")
execute_process(COMMAND objcopy
--redefine-sym argon2_hash=libargon2_argon2_hash
--redefine-sym _argon2_hash=_libargon2_argon2_hash
--redefine-sym argon2_error_message=libargon2_argon2_error_message
--redefine-sym _argon2_error_message=_libargon2_argon2_error_message
${ARGON2_SYS_LIBRARIES} ${CMAKE_BINARY_DIR}/libargon2_patched.a
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
find_library(ARGON2_LIBRARIES libargon2_patched.a PATHS ${CMAKE_BINARY_DIR} NO_DEFAULT_PATH)
else()
find_library(ARGON2_LIBRARIES argon2)
find_library(ARGON2_LIBRARIES argon2)
endif()
mark_as_advanced(ARGON2_LIBRARIES ARGON2_INCLUDE_DIR)

Expand Down
2 changes: 1 addition & 1 deletion cmake/FindGcrypt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mark_as_advanced(GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIR)
if(GCRYPT_INCLUDE_DIR AND EXISTS "${GCRYPT_INCLUDE_DIR}/gcrypt.h")
file(STRINGS "${GCRYPT_INCLUDE_DIR}/gcrypt.h" GCRYPT_H REGEX "^#define GCRYPT_VERSION \"[^\"]*\"$")
string(REGEX REPLACE "^.*GCRYPT_VERSION \"([0-9]+).*$" "\\1" GCRYPT_VERSION_MAJOR "${GCRYPT_H}")
string(REGEX REPLACE "^.*GCRYPT_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" GCRYPT_VERSION_MINOR "${GCRYPT_H}")
string(REGEX REPLACE "^.*GCRYPT_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" GCRYPT_VERSION_MINOR "${GCRYPT_H}")
string(REGEX REPLACE "^.*GCRYPT_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" GCRYPT_VERSION_PATCH "${GCRYPT_H}")
set(GCRYPT_VERSION_STRING "${GCRYPT_VERSION_MAJOR}.${GCRYPT_VERSION_MINOR}.${GCRYPT_VERSION_PATCH}")
endif()
Expand Down
Loading

0 comments on commit 77adbef

Please sign in to comment.