2014-07-11 02:31:24 +04:00
|
|
|
# TODO: OSX and LIB_ONLY seem to require this to go to binary dir only
|
2014-08-08 13:59:14 +04:00
|
|
|
if(NOT TOKEN_AUTH_ONLY)
|
2014-03-11 19:55:53 +04:00
|
|
|
endif()
|
2011-10-19 13:53:12 +04:00
|
|
|
|
2013-08-23 12:16:54 +04:00
|
|
|
set(synclib_NAME ${APPLICATION_EXECUTABLE}sync)
|
2013-07-08 03:44:11 +04:00
|
|
|
|
2020-05-14 22:15:45 +03:00
|
|
|
find_package(Qt5 5.12 COMPONENTS Core Network Xml Concurrent WebEngineWidgets WebEngine REQUIRED)
|
2017-12-14 17:10:33 +03:00
|
|
|
|
2016-04-12 15:43:04 +03:00
|
|
|
if(NOT TOKEN_AUTH_ONLY)
|
|
|
|
find_package(Qt5Keychain REQUIRED)
|
|
|
|
endif()
|
|
|
|
|
2017-12-10 19:03:19 +03:00
|
|
|
if(NOT MSVC)
|
2017-12-16 16:03:59 +03:00
|
|
|
if(NOT (CMAKE_SYSTEM_PROCESSOR MATCHES "^(alpha|parisc|hppa)"))
|
2017-12-11 17:18:30 +03:00
|
|
|
if((CMAKE_CXX_COMPILER_ID MATCHES "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9))
|
2017-12-04 14:12:21 +03:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector --param=ssp-buffer-size=4")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector --param=ssp-buffer-size=4")
|
2017-12-11 17:18:30 +03:00
|
|
|
else()
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-strong")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-strong")
|
2017-12-01 13:55:42 +03:00
|
|
|
endif()
|
|
|
|
endif()
|
2017-09-20 19:26:06 +03:00
|
|
|
|
|
|
|
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
|
|
|
|
if(CMAKE_BUILD_TYPE_LOWER MATCHES "(release|relwithdebinfo|minsizerel)")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FORTIFY_SOURCE=2")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORTIFY_SOURCE=2")
|
|
|
|
endif()
|
|
|
|
|
2019-10-20 13:52:52 +03:00
|
|
|
# Calling Qt's qCWarning(category, ...) with no params for "..." is a GNU
|
|
|
|
# extension (C++11 §16.3/4 forbids them). Silence clang's warnings.
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-gnu-zero-variadic-macro-arguments")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-gnu-zero-variadic-macro-arguments")
|
|
|
|
endif()
|
2019-10-18 06:17:23 +03:00
|
|
|
|
2017-12-10 19:03:19 +03:00
|
|
|
if(WIN32)
|
2020-08-01 00:51:28 +03:00
|
|
|
# Enable DEP, ASLR and CFG
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /nxcompat /dynamicbase /guard:cf")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /nxcompat /dynamicbase /guard:cf")
|
|
|
|
|
|
|
|
# x86 only: Enable SafeSEH
|
|
|
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /safeseh")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /safeseh")
|
|
|
|
endif()
|
2017-12-10 19:03:19 +03:00
|
|
|
elseif(UNIX AND NOT APPLE)
|
2017-09-20 19:26:06 +03:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now")
|
2017-09-04 14:42:20 +03:00
|
|
|
endif()
|
|
|
|
|
2017-10-30 17:39:40 +03:00
|
|
|
include_directories(
|
|
|
|
${CMAKE_SOURCE_DIR}/src/3rdparty
|
|
|
|
)
|
|
|
|
|
2020-01-19 22:13:12 +03:00
|
|
|
set(QML_IMPORT_PATH ${CMAKE_SOURCE_DIR}/theme CACHE STRING "" FORCE)
|
|
|
|
|
2017-08-14 20:19:52 +03:00
|
|
|
add_subdirectory(csync)
|
2014-07-11 02:31:24 +04:00
|
|
|
add_subdirectory(libsync)
|
2014-07-11 14:36:01 +04:00
|
|
|
if (NOT BUILD_LIBRARIES_ONLY)
|
|
|
|
add_subdirectory(cmd)
|
2020-06-06 20:53:48 +03:00
|
|
|
add_subdirectory(gui)
|
2014-08-26 20:07:42 +04:00
|
|
|
|
|
|
|
if (WITH_CRASHREPORTER)
|
|
|
|
add_subdirectory(3rdparty/libcrashreporter-qt)
|
|
|
|
add_subdirectory(crashreporter)
|
|
|
|
endif()
|
2014-07-11 14:36:01 +04:00
|
|
|
endif(NOT BUILD_LIBRARIES_ONLY)
|
2012-05-21 20:09:30 +04:00
|
|
|
|
2012-06-04 18:44:49 +04:00
|
|
|
find_program(KRAZY2_EXECUTABLE krazy2)
|
|
|
|
if(KRAZY2_EXECUTABLE)
|
2012-06-05 17:11:29 +04:00
|
|
|
# s/y k/y ALL k/ for building this target always
|
|
|
|
add_custom_target( krazy krazy2 --check-sets c++,qt4,foss
|
2014-07-14 14:19:32 +04:00
|
|
|
${PROJECT_SOURCE_DIR}/src/libsync/*.ui
|
|
|
|
${PROJECT_SOURCE_DIR}/src/libsync/*.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/libsync/*.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/src/gui/*.ui
|
|
|
|
${PROJECT_SOURCE_DIR}/src/gui/*.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/gui/*.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/src/cmd/*.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/cmd/*.cpp
|
2012-05-21 20:09:30 +04:00
|
|
|
)
|
2012-06-04 18:44:49 +04:00
|
|
|
endif()
|