Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: 2011 ownCloud GmbH
# SPDX-License-Identifier: GPL-2.0-or-later
cmake_minimum_required(VERSION 3.16)
cmake_policy(SET CMP0071 NEW) # Enable use of QtQuick compiler/generated code

project(client)

Expand All @@ -11,7 +10,7 @@ if(APPLE)
endif()

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include(FeatureSummary)

Expand Down Expand Up @@ -302,8 +301,8 @@ add_definitions(-DNTDDI_VERSION=0x0A000004)
# Also: Disable compiler warnings because we don't use Windows CRT safe-functions explicitly and don't intend to
# as this is a pure cross-platform source the only alternative would be a ton of ifdefs with calls to the _s version
add_definitions( -D_CRT_SECURE_NO_WARNINGS )
endif( MSVC )
endif( WIN32 )
endif()
endif()

if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
Expand All @@ -318,8 +317,8 @@ if(BUILD_CLIENT)
if(NOT BUILD_LIBRARIES_ONLY)
if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/admin)
add_subdirectory(admin)
endif(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/admin)
endif(NOT BUILD_LIBRARIES_ONLY)
endif()
endif()
endif()

if(BUILD_SHELL_INTEGRATION)
Expand Down
2 changes: 1 addition & 1 deletion CPackOptions.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
if(CPACK_GENERATOR MATCHES "NSIS")
SET( CPACK_PACKAGE_ICON @CMAKE_SOURCE_DIR@/admin/win/nsi/installer.ico ) # A branding image that will be displayed on the top bar inside the installer. installer.bmp
SET( CPACK_NSIS_COMPRESSOR "/SOLID lzma" ) # The arguments that will be passed to the NSIS SetCompressor command. /SOLID lzma
endif(CPACK_GENERATOR MATCHES "NSIS")
endif()

set( CMAKE_SOURCE_DIR @CMAKE_SOURCE_DIR@ )
set( CMAKE_BINARY_DIR @CMAKE_BINARY_DIR@ )
Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/AddCMockaTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ if(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW)
set(CMAKE_SHARED_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
set(CMAKE_MODULE_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
set(CMAKE_EXEC_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
endif(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW)
endif()

function (ADD_CMOCKA_TEST _testName _testSource)
add_executable(${_testName} ${_testSource})
set_target_properties(${_testName} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY})
target_link_libraries(${_testName} ${ARGN})
add_test(${_testName} ${BIN_OUTPUT_DIRECTORY}/${_testName})
endfunction (ADD_CMOCKA_TEST)
endfunction ()
2 changes: 1 addition & 1 deletion cmake/modules/CheckCCompilerFlagSSP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ function(CHECK_C_COMPILER_FLAG_SSP _FLAG _RESULT)
set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
check_c_source_compiles("int main(int argc, char **argv) { char buffer[256]; return buffer[argc]=0;}" ${_RESULT})
set(CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
endfunction(CHECK_C_COMPILER_FLAG_SSP)
endfunction()
18 changes: 9 additions & 9 deletions cmake/modules/DefineCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,29 @@ if (${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)")
set(CSYNC_STRICT OFF CACHE BOOL "Strict error checking, enabled -Werror and friends")
if (CSYNC_STRICT)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
endif(CSYNC_STRICT)
endif()

# with -fPIC
check_c_compiler_flag("-fPIC" WITH_FPIC)
if (WITH_FPIC AND NOT WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
endif (WITH_FPIC AND NOT WIN32)
endif ()

check_c_compiler_flag_ssp("-fstack-protector" WITH_STACK_PROTECTOR)
if (WITH_STACK_PROTECTOR AND NOT WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector")
endif (WITH_STACK_PROTECTOR AND NOT WIN32)
endif ()

if (CMAKE_BUILD_TYPE)
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
if (CMAKE_BUILD_TYPE_LOWER MATCHES "(release|relwithdebinfo|minsizerel)" AND (NOT ${CMAKE_C_FLAGS} MATCHES "FORTIFY_SOURCE=[3-9]"))
check_c_compiler_flag("-Wp,-D_FORTIFY_SOURCE=2" WITH_FORTIFY_SOURCE)
if (WITH_FORTIFY_SOURCE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wp,-D_FORTIFY_SOURCE=2")
endif (WITH_FORTIFY_SOURCE)
endif ()
endif()
endif()
endif (${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)")
endif ()

if (UNIX AND NOT WIN32)
#
Expand All @@ -80,19 +80,19 @@ if (UNIX AND NOT WIN32)
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif (CMAKE_SIZEOF_VOID_P MATCHES "8")
endif ()
if (_lfs_CFLAGS)
string(REGEX REPLACE "[\r\n]" " " "${_lfs_CFLAGS}" "${${_lfs_CFLAGS}}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_lfs_CFLAGS}")
endif (_lfs_CFLAGS)
endif ()
else(UNIX AND NOT WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64")
endif (UNIX AND NOT WIN32)
endif ()

if (MSVC)
# Use secure functions by default and suppress warnings about
#"deprecated" functions
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_NONSTDC_NO_WARNINGS=1 /D _CRT_SECURE_NO_WARNINGS=1")
endif (MSVC)
endif ()
4 changes: 2 additions & 2 deletions cmake/modules/DefineInstallationPaths.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ if (UNIX)
"${SHARE_INSTALL_PREFIX}/info"
CACHE PATH "The ${APPLICATION_SHORTNAME} info install dir (default prefix/info)"
)
endif (UNIX)
endif ()

if (WIN32)
# Same same
Expand All @@ -110,4 +110,4 @@ if (WIN32)
set(LOCALE_INSTALL_DIR "lang" CACHE PATH "-")
set(SYSCONF_INSTALL_DIR "config" CACHE PATH "-")
set(MAN_INSTALL_DIR "man" CACHE PATH "-")
endif (WIN32)
endif ()
12 changes: 6 additions & 6 deletions cmake/modules/DefinePlatformDefaults.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@

if (CMAKE_SYSTEM_NAME MATCHES "Linux")
set(LINUX TRUE)
endif(CMAKE_SYSTEM_NAME MATCHES "Linux")
endif()

if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(FREEBSD TRUE)
set(BSD TRUE)
endif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
endif ()

if (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
set(OPENBSD TRUE)
set(BSD TRUE)
endif (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
endif ()

if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
set(NETBSD TRUE)
set(BSD TRUE)
endif (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
endif ()

if (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
set(SOLARIS TRUE)
endif (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
endif ()

if (CMAKE_SYSTEM_NAME MATCHES "OS2")
set(OS2 TRUE)
endif (CMAKE_SYSTEM_NAME MATCHES "OS2")
endif ()
2 changes: 1 addition & 1 deletion cmake/modules/FindCMocka.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ if (CMOCKA_LIBRARY)
${CMOCKA_LIBRARIES}
${CMOCKA_LIBRARY}
)
endif (CMOCKA_LIBRARY)
endif ()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CMocka DEFAULT_MSG CMOCKA_LIBRARIES CMOCKA_INCLUDE_DIR)
Expand Down
12 changes: 6 additions & 6 deletions cmake/modules/FindLibSSH.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ else (LIBSSH_LIBRARIES AND LIBSSH_INCLUDE_DIRS)

if (LIBSSH_INCLUDE_DIR AND SSH_LIBRARY)
set(SSH_FOUND TRUE)
endif (LIBSSH_INCLUDE_DIR AND SSH_LIBRARY)
endif ()

set(LIBSSH_INCLUDE_DIRS
${LIBSSH_INCLUDE_DIR}
Expand Down Expand Up @@ -78,20 +78,20 @@ else (LIBSSH_LIBRARIES AND LIBSSH_INCLUDE_DIRS)
else (LIBSSH_VERSION_MAJOR)
message(STATUS "LIBSSH_VERSION_MAJOR not found in ${LIBSSH_INCLUDE_DIR}/libssh/libssh.h, assuming libssh is too old")
set(LIBSSH_FOUND FALSE)
endif (LIBSSH_VERSION_MAJOR)
endif (LibSSH_FIND_VERSION)
endif (SSH_FOUND)
endif ()
endif ()
endif ()

# If the version is too old, but libs and includes are set,
# find_package_handle_standard_args will set LIBSSH_FOUND to TRUE again,
# so we need this if() here.
if (LIBSSH_FOUND)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibSSH DEFAULT_MSG LIBSSH_LIBRARIES LIBSSH_INCLUDE_DIRS)
endif (LIBSSH_FOUND)
endif ()

# show the LIBSSH_INCLUDE_DIRS and LIBSSH_LIBRARIES variables only in the advanced view
mark_as_advanced(LIBSSH_INCLUDE_DIRS LIBSSH_LIBRARIES)

endif (LIBSSH_LIBRARIES AND LIBSSH_INCLUDE_DIRS)
endif ()

22 changes: 11 additions & 11 deletions cmake/modules/FindPackageVersionCheck.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,38 +34,38 @@ function(FIND_PACKAGE_VERSION_CHECK _NAME _FAIL_MSG)
set(_AGE "new")
else (${_NAME}_FIND_VERSION VERSION_LESS ${_NAME}_VERSION)
set(_AGE "old")
endif (${_NAME}_FIND_VERSION VERSION_LESS ${_NAME}_VERSION)
endif (${_NAME}_FIND_VERSION VERSION_EQUAL ${_NAME}_VERSION)
endif ()
endif ()
else (${_NAME}_FIND_VERSION_EXACT)
if (${_NAME}_FIND_VERSION)
if (${_NAME}_VERSION VERSION_LESS ${_NAME}_FIND_VERSION)
set(${_NAME_UPPER}_FOUND FALSE)
set(_AGE "old")
else (${_NAME}_VERSION VERSION_LESS ${_NAME}_FIND_VERSION)
set(${_NAME_UPPER}_FOUND TRUE)
endif (${_NAME}_VERSION VERSION_LESS ${_NAME}_FIND_VERSION)
endif (${_NAME}_FIND_VERSION)
endif(${_NAME}_FIND_VERSION_EXACT)
endif ()
endif ()
endif()

if ("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
if (${_NAME}_FIND_VERSION_EXACT)
set(_FAIL_MESSAGE "The installed ${_NAME} version ${${_NAME}_VERSION} is too ${_AGE}, version ${${_NAME}_FIND_VERSION} is required.")
else (${_NAME}_FIND_VERSION_EXACT)
set(_FAIL_MESSAGE "The installed ${_NAME} version ${${_NAME}_VERSION} is too ${_AGE}, at least version ${${_NAME}_FIND_VERSION} is required.")
endif (${_NAME}_FIND_VERSION_EXACT)
endif ()
else ("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
set(_FAIL_MESSAGE "${_FAIL_MSG}")
endif ("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
endif ()

if (NOT ${_NAME_UPPER}_FOUND)
if (${_NAME}_FIND_REQUIRED)
message(FATAL_ERROR "${_FAIL_MESSAGE}")
else (${_NAME}_FIND_REQUIRED)
if (NOT ${_NAME}_FIND_QUIETLY)
message(STATUS "${_FAIL_MESSAGE}")
endif (NOT ${_NAME}_FIND_QUIETLY)
endif (${_NAME}_FIND_REQUIRED)
endif (NOT ${_NAME_UPPER}_FOUND)
endif ()
endif ()
endif ()

set(${_NAME_UPPER}_FOUND ${${_NAME_UPPER}_FOUND} PARENT_SCOPE)
endfunction(FIND_PACKAGE_VERSION_CHECK)
endfunction()
6 changes: 3 additions & 3 deletions cmake/modules/FindSMBClient.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ else (SMBCLIENT_LIBRARIES AND SMBCLIENT_INCLUDE_DIRS)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(_SMBCLIENT smbclient)
endif (PKG_CONFIG_FOUND)
endif ()

find_path(SMBCLIENT_INCLUDE_DIR
NAMES
Expand Down Expand Up @@ -55,13 +55,13 @@ else (SMBCLIENT_LIBRARIES AND SMBCLIENT_INCLUDE_DIRS)
${SMBCLIENT_LIBRARIES}
${SMBCLIENT_LIBRARY}
)
endif (SMBCLIENT_LIBRARY)
endif ()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SMBClient DEFAULT_MSG SMBCLIENT_LIBRARIES SMBCLIENT_INCLUDE_DIRS)

# show the SMBCLIENT_INCLUDE_DIRS and SMBCLIENT_LIBRARIES variables only in the advanced view
mark_as_advanced(SMBCLIENT_INCLUDE_DIRS SMBCLIENT_LIBRARIES)

endif (SMBCLIENT_LIBRARIES AND SMBCLIENT_INCLUDE_DIRS)
endif ()

4 changes: 2 additions & 2 deletions cmake/modules/MacroAddCompileFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ macro (MACRO_ADD_COMPILE_FLAGS _target)
set(_flags ${_flags} ${ARGN})
else (_flags)
set(_flags ${ARGN})
endif (_flags)
endif ()

set_target_properties(${_target} PROPERTIES COMPILE_FLAGS ${_flags})

endmacro (MACRO_ADD_COMPILE_FLAGS)
endmacro ()
4 changes: 2 additions & 2 deletions cmake/modules/MacroAddLinkFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ macro (MACRO_ADD_LINK_FLAGS _target)
set(_flags "${_flags} ${ARGN}")
else (_flags)
set(_flags "${ARGN}")
endif (_flags)
endif ()

set_target_properties(${_target} PROPERTIES LINK_FLAGS "${_flags}")

endmacro (MACRO_ADD_LINK_FLAGS)
endmacro ()
4 changes: 2 additions & 2 deletions cmake/modules/MacroEnsureOutOfSourceBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ macro (MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage)
if (_insource)
message(SEND_ERROR "${_errorMessage}")
message(FATAL_ERROR "Remove the file CMakeCache.txt in ${CMAKE_SOURCE_DIR} first.")
endif (_insource)
endif ()

endmacro (MACRO_ENSURE_OUT_OF_SOURCE_BUILD)
endmacro ()
Loading
Loading