Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2017-12-14 19:54:31 +0300
committerDominik Schmidt <dev@dominik-schmidt.de>2018-01-13 15:58:17 +0300
commit3ae327ea8ea31da46995da01c6b623c14248dc65 (patch)
tree1d6ed12187c29bb42e794f1839c8dabcd263f240
parent1c721e9422069744dcc3447219487bf2695a81b6 (diff)
Modernize out CMakeLists.txt
Mainly uses target_include_directories instead of include_directories so libraries public include directory get automatically added when adding the target in target_link_library
-rw-r--r--CMakeLists.txt11
-rw-r--r--src/cmd/CMakeLists.txt16
-rw-r--r--src/crashreporter/CMakeLists.txt9
-rw-r--r--src/csync/CMakeLists.txt62
-rw-r--r--src/gui/CMakeLists.txt30
-rw-r--r--src/libsync/CMakeLists.txt40
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/csync/CMakeLists.txt8
8 files changed, 48 insertions, 130 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 132d93b1c..0f4abfd3c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.1)
project(client)
@@ -183,15 +183,6 @@ if(BUILD_CLIENT)
find_package(Sphinx)
find_package(PdfLatex)
- find_package(SQLite3 3.8.0 REQUIRED)
- # On some OS, we want to use our own, not the system sqlite
- if (USE_OUR_OWN_SQLITE3)
- include_directories(BEFORE ${SQLITE3_INCLUDE_DIR})
- if (WIN32)
- add_definitions(-DSQLITE_API=__declspec\(dllimport\))
- endif()
- endif()
-
find_package(ZLIB REQUIRED)
endif()
diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt
index 4244fba8c..449313668 100644
--- a/src/cmd/CMakeLists.txt
+++ b/src/cmd/CMakeLists.txt
@@ -7,17 +7,7 @@ set(cmd_SRC
simplesslerrorhandler.cpp
netrcparser.cpp
)
-include_directories(${CMAKE_SOURCE_DIR}/src/libsync
- ${CMAKE_BINARY_DIR}/src/libsync
- )
-# csync is required.
-include_directories(${CMAKE_SOURCE_DIR}/src/csync
- ${CMAKE_BINARY_DIR}/src/csync
- )
-
-# Need tokenizer for netrc parser
-include_directories(${CMAKE_SOURCE_DIR}/src/3rdparty/qtokenizer)
if(UNIX AND NOT APPLE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE")
@@ -32,7 +22,10 @@ if(NOT BUILD_LIBRARIES_ONLY)
set_target_properties(${cmd_NAME} PROPERTIES
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/${APPLICATION_EXECUTABLE};${CMAKE_INSTALL_RPATH}" )
- target_link_libraries(${cmd_NAME} ${synclib_NAME} Qt5::Core Qt5::Network)
+ target_link_libraries(${cmd_NAME} ocsync ${synclib_NAME} Qt5::Core Qt5::Network)
+
+ # Need tokenizer for netrc parser
+ target_include_directories(${cmd_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/src/3rdparty/qtokenizer)
endif()
if(BUILD_OWNCLOUD_OSX_BUNDLE)
@@ -44,7 +37,6 @@ elseif(NOT BUILD_LIBRARIES_ONLY)
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
-
# FIXME: The following lines are dup in src/gui and src/cmd because it needs to be done after both are installed
#FIXME: find a nice solution to make the second if(BUILD_OWNCLOUD_OSX_BUNDLE) unnecessary
# currently it needs to be done because the code right above needs to be executed no matter
diff --git a/src/crashreporter/CMakeLists.txt b/src/crashreporter/CMakeLists.txt
index 0d7938a34..3354e9a5e 100644
--- a/src/crashreporter/CMakeLists.txt
+++ b/src/crashreporter/CMakeLists.txt
@@ -4,10 +4,6 @@ cmake_policy(SET CMP0017 NEW)
list(APPEND crashreporter_SOURCES main.cpp)
list(APPEND crashreporter_RC resources.qrc)
-qt_wrap_ui( crashreporter_UI_HEADERS ${crashreporter_UI} )
-qt_add_resources( crashreporter_RC_RCC ${crashreporter_RC} )
-
-
# TODO: differentiate release channel
# if(BUILD_RELEASE)
# set(CRASHREPORTER_RELEASE_CHANNEL "release")
@@ -19,10 +15,6 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CrashReporterConfig.h.in
${CMAKE_CURRENT_BINARY_DIR}/CrashReporterConfig.h)
-include_directories(${CMAKE_CURRENT_BINARY_DIR}
- "../3rdparty/libcrashreporter-qt/src/"
-)
-
if(NOT BUILD_LIBRARIES_ONLY)
add_executable( ${CRASHREPORTER_EXECUTABLE} WIN32
@@ -32,6 +24,7 @@ if(NOT BUILD_LIBRARIES_ONLY)
${crashreporter_RC_RCC}
)
+ target_include_directories(${CRASHREPORTER_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/libcrashreporter-qt/src/" )
set_target_properties(${CRASHREPORTER_EXECUTABLE} PROPERTIES AUTOMOC ON)
set_target_properties(${CRASHREPORTER_EXECUTABLE} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY} )
set_target_properties(${CRASHREPORTER_EXECUTABLE} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/${APPLICATION_EXECUTABLE}" )
diff --git a/src/csync/CMakeLists.txt b/src/csync/CMakeLists.txt
index 1d3207056..a10ac3b05 100644
--- a/src/csync/CMakeLists.txt
+++ b/src/csync/CMakeLists.txt
@@ -23,32 +23,6 @@ if (MEM_NULL_TESTS)
add_definitions(-DCSYNC_MEM_NULL_TESTS)
endif (MEM_NULL_TESTS)
-# Statically include sqlite
-
-set(CSYNC_PUBLIC_INCLUDE_DIRS
- ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/std
- ${CMAKE_SOURCE_DIR}
- CACHE INTERNAL "csync public include directories"
-)
-
-set(CSYNC_PRIVATE_INCLUDE_DIRS
- ${SQLITE3_INCLUDE_DIRS}
- ${CMAKE_BINARY_DIR}
-)
-
-set(CSYNC_LIBRARY
- ocsync
- CACHE INTERNAL "ocsync library"
-)
-
-set(CSYNC_LINK_LIBRARIES
- ${CSYNC_REQUIRED_LIBRARIES}
- ${SQLITE3_LIBRARIES}
- Qt5::Core Qt5::Concurrent
-)
-
# Specific option for builds tied to servers that do not support renaming extensions
set(NO_RENAME_EXTENSION 0 CACHE BOOL "Do not issue rename if the extension changes")
if(NO_RENAME_EXTENSION)
@@ -89,39 +63,39 @@ if(NOT HAVE_ASPRINTF AND NOT HAVE___MINGW_ASPRINTF)
list(APPEND csync_SRCS std/asprintf.c)
endif()
-
-configure_file(csync_version.h.in ${CMAKE_CURRENT_BINARY_DIR}/csync_version.h)
-
-
-# Statically include sqlite
if (USE_OUR_OWN_SQLITE3)
list(APPEND csync_SRCS ${SQLITE3_SOURCE})
- if (WIN32)
- # We want to export sqlite symbols from the ocsync DLL without
- # having to patch both sqlite3.h and the amalgation sqlite3.c,
- # so do the import/export magic manually through the build system.
- remove_definitions(-DSQLITE_API=__declspec\(dllimport\))
- add_definitions(-DSQLITE_API=__declspec\(dllexport\))
- endif()
endif()
+configure_file(csync_version.h.in ${CMAKE_CURRENT_BINARY_DIR}/csync_version.h)
+set(CSYNC_LIBRARY ocsync)
add_library(${CSYNC_LIBRARY} SHARED ${common_SOURCES} ${csync_SRCS})
-#add_library(${CSYNC_LIBRARY}_static STATIC ${csync_SRCS})
target_include_directories(
${CSYNC_LIBRARY}
- PUBLIC ${CSYNC_PUBLIC_INCLUDE_DIRS}
- PRIVATE ${CSYNC_PRIVATE_INCLUDE_DIRS}
+ PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/std
)
-generate_export_header( ${CSYNC_LIBRARY}
+find_package(SQLite3 3.8.0 REQUIRED)
+if (USE_OUR_OWN_SQLITE3)
+ # make sure that the path for the local sqlite3 is before the system one
+ target_include_directories(${CSYNC_LIBRARY} BEFORE PRIVATE ${SQLITE3_INCLUDE_DIR})
+else()
+ target_include_directories(${CSYNC_LIBRARY} PRIVATE ${SQLITE3_INCLUDE_DIR})
+endif()
+
+
+generate_export_header(${CSYNC_LIBRARY}
EXPORT_MACRO_NAME OCSYNC_EXPORT
EXPORT_FILE_NAME ocsynclib.h
)
-target_link_libraries(${CSYNC_LIBRARY} ${CSYNC_LINK_LIBRARIES})
-#target_link_libraries(${CSYNC_LIBRARY}_static ${CSYNC_LINK_LIBRARIES})
+target_link_libraries(${CSYNC_LIBRARY}
+ ${CSYNC_REQUIRED_LIBRARIES}
+ ${SQLITE3_LIBRARIES}
+ Qt5::Core Qt5::Concurrent
+)
if(ZLIB_FOUND)
target_link_libraries(${CSYNC_LIBRARY} ZLIB::ZLIB)
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index b04159ad8..e347c3831 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -173,23 +173,6 @@ else()
list(APPEND 3rdparty_SRC ../3rdparty/qtlockedfile/qtlockedfile_win.cpp )
endif()
-set(3rdparty_INC
- ${CMAKE_SOURCE_DIR}/src/3rdparty/QProgressIndicator
- ${CMAKE_SOURCE_DIR}/src/3rdparty/qtlockedfile
- ${CMAKE_SOURCE_DIR}/src/3rdparty/qtmacgoodies/src
- ${CMAKE_SOURCE_DIR}/src/3rdparty/qtsingleapplication
- )
-
-include_directories(${3rdparty_INC})
-
-# csync is required.
-include_directories(${CMAKE_SOURCE_DIR}/src/csync
- ${CMAKE_BINARY_DIR}/src/csync
- )
-include_directories(../libsync ${CMAKE_CURRENT_BINARY_DIR}/../libsync)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- )
find_package(Qt5LinguistTools)
if(Qt5LinguistTools_FOUND)
@@ -285,8 +268,9 @@ else()
install(FILES ${qtkeychain_I18N} DESTINATION ${QM_DIR})
endif()
-add_library(updater STATIC ${updater_SRCS} ${updaterMoc})
+add_library(updater STATIC ${updater_SRCS})
target_link_libraries(updater ${synclib_NAME} Qt5::Widgets Qt5::Network Qt5::Xml)
+target_include_directories(updater PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY}
@@ -300,6 +284,14 @@ target_link_libraries( ${APPLICATION_EXECUTABLE} ${synclib_NAME} )
target_link_libraries( ${APPLICATION_EXECUTABLE} updater )
target_link_libraries( ${APPLICATION_EXECUTABLE} ${OS_SPECIFIC_LINK_LIBRARIES} )
+target_include_directories(${APPLICATION_EXECUTABLE} PRIVATE
+ ${CMAKE_SOURCE_DIR}/src/3rdparty/QProgressIndicator
+ ${CMAKE_SOURCE_DIR}/src/3rdparty/qtlockedfile
+ ${CMAKE_SOURCE_DIR}/src/3rdparty/qtmacgoodies/src
+ ${CMAKE_SOURCE_DIR}/src/3rdparty/qtsingleapplication
+ ${CMAKE_CURRENT_BINARY_DIR}
+)
+
## handle DBUS for Fdo notifications
if( UNIX AND NOT APPLE )
find_package(Qt5 COMPONENTS DBus)
@@ -314,7 +306,7 @@ endif()
if(WITH_CRASHREPORTER)
target_link_libraries( ${APPLICATION_EXECUTABLE} crashreporter-handler)
- include_directories( "../3rdparty/libcrashreporter-qt/src/" )
+ target_include_directories(${APPLICATION_EXECUTABLE} "../3rdparty/libcrashreporter-qt/src/" )
if(UNIX AND NOT MAC)
find_package(Threads REQUIRED)
diff --git a/src/libsync/CMakeLists.txt b/src/libsync/CMakeLists.txt
index 6b0633da5..69092f2f3 100644
--- a/src/libsync/CMakeLists.txt
+++ b/src/libsync/CMakeLists.txt
@@ -1,11 +1,6 @@
project(libsync)
set(CMAKE_AUTOMOC TRUE)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
-# csync is required.
-include_directories(${CMAKE_SOURCE_DIR}/src/csync
- ${CMAKE_BINARY_DIR}/src/csync
- )
if ( APPLE )
list(APPEND OS_SPECIFIC_LINK_LIBRARIES
@@ -94,7 +89,8 @@ IF (NOT APPLE)
)
ENDIF(NOT APPLE)
-list(APPEND libsync_LINK_TARGETS
+add_library(${synclib_NAME} SHARED ${libsync_SRCS})
+target_link_libraries(${synclib_NAME}
ocsync
${OS_SPECIFIC_LINK_LIBRARIES}
Qt5::Core Qt5::Network
@@ -102,20 +98,16 @@ list(APPEND libsync_LINK_TARGETS
if (NOT TOKEN_AUTH_ONLY)
find_package(Qt5 REQUIRED COMPONENTS Widgets)
- list(APPEND libsync_LINK_TARGETS Qt5::Widgets)
-endif()
-
-if(QTKEYCHAIN_FOUND OR QT5KEYCHAIN_FOUND)
- list(APPEND libsync_LINK_TARGETS ${QTKEYCHAIN_LIBRARY})
- include_directories(${QTKEYCHAIN_INCLUDE_DIR})
+ target_link_libraries(${synclib_NAME} Qt5::Widgets ${QTKEYCHAIN_LIBRARY})
+ target_include_directories(${synclib_NAME} PRIVATE ${QTKEYCHAIN_INCLUDE_DIR})
endif()
if(INOTIFY_FOUND)
- include_directories(${INOTIFY_INCLUDE_DIR})
+ target_include_directories(${synclib_NAME} PRIVATE ${INOTIFY_INCLUDE_DIR})
link_directories(${INOTIFY_LIBRARY_DIR})
+ target_link_libraries(${synclib_NAME} ${INOTIFY_LIBRARY} )
endif()
-add_library(${synclib_NAME} SHARED ${libsync_SRCS} ${syncMoc})
GENERATE_EXPORT_HEADER( ${synclib_NAME}
BASE_NAME ${synclib_NAME}
EXPORT_MACRO_NAME OWNCLOUDSYNC_EXPORT
@@ -123,6 +115,8 @@ GENERATE_EXPORT_HEADER( ${synclib_NAME}
STATIC_DEFINE OWNCLOUD_BUILT_AS_STATIC
)
+target_include_directories(${synclib_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
+
set_target_properties( ${synclib_NAME} PROPERTIES
VERSION ${MIRALL_VERSION}
@@ -132,24 +126,6 @@ set_target_properties( ${synclib_NAME} PROPERTIES
set_target_properties( ${synclib_NAME} PROPERTIES
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/${APPLICATION_EXECUTABLE};${CMAKE_INSTALL_RPATH}" )
-target_link_libraries(${synclib_NAME} ${libsync_LINK_TARGETS} )
-
-if(INOTIFY_FOUND)
- target_link_libraries(${synclib_NAME} ${INOTIFY_LIBRARY} )
-endif()
-
-if(BUILD_LIBRARIES_ONLY)
- #add_library(${synclib_NAME}_static STATIC ${libsync_SRCS} ${syncMoc})
- #qt5_use_modules(${synclib_NAME}_static Widgets Network Xml Sql)
-
- #set_target_properties( ${synclib_NAME}_static PROPERTIES
- # VERSION ${MIRALL_VERSION}
- # SOVERSION ${MIRALL_SOVERSION}
- #)
-
- #target_link_libraries(${synclib_NAME}_static ${libsync_LINK_TARGETS} )
-endif()
-
if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
install(TARGETS ${synclib_NAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 4617dfd2e..a2879a42b 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,3 +1,4 @@
+find_package(SQLite3 3.8.0 REQUIRED)
include_directories(${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/3rdparty/qtokenizer
${CMAKE_SOURCE_DIR}/src/csync
@@ -8,6 +9,7 @@ include_directories(${CMAKE_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/src/libsync
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
+ ${SQLITE3_INCLUDE_DIR}
)
include(owncloud_add_test.cmake)
diff --git a/test/csync/CMakeLists.txt b/test/csync/CMakeLists.txt
index f5f7b68fb..a7ec9f133 100644
--- a/test/csync/CMakeLists.txt
+++ b/test/csync/CMakeLists.txt
@@ -1,11 +1,9 @@
-project(tests C)
+project(tests)
set(TORTURE_LIBRARY torture)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
- ${CSYNC_PUBLIC_INCLUDE_DIRS}
- ${CSTDLIB_PUBLIC_INCLUDE_DIRS}
${CMAKE_BINARY_DIR}
${CMOCKA_INCLUDE_DIR}
)
@@ -13,9 +11,9 @@ include_directories(
include_directories(${CHECK_INCLUDE_DIRS})
# create test library
add_library(${TORTURE_LIBRARY} STATIC torture.c cmdline.c)
-target_link_libraries(${TORTURE_LIBRARY} ${CMOCKA_LIBRARIES} ${CSYNC_LIBRARY} ${CSTDLIB_LIBRARY})
+target_link_libraries(${TORTURE_LIBRARY} ${CMOCKA_LIBRARIES} ${CSYNC_LIBRARY})
-set(TEST_TARGET_LIBRARIES ${TORTURE_LIBRARY})
+set(TEST_TARGET_LIBRARIES ${TORTURE_LIBRARY} Qt5::Core ocsync)
# create tests