Changeset: 79ed2e0c7556 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=79ed2e0c7556 Modified Files: CMakeLists.txt Release.md cmake/monetdb-findpackages.cmake cmake/monetdb-functions.cmake monetdb_config.h.in monetdb_config_win32.h.in Branch: mbedded Log Message:
cleanup cmake code, part 1 of many diffs (truncated from 602 to 300 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,8 +42,8 @@ include(CheckTypeSize REQUIRED) include(TestBigEndian REQUIRED) +include(monetdb-functions) include(monetdb-findpackages) -include(monetdb-functions) monetdb_hg_revision() check_symbol_exists("opendir" "dirent.h" HAVE_DIRENT_H) @@ -146,19 +146,20 @@ check_function_exists("uname" HAVE_UNAME check_symbol_exists("semtimedop" "sys/types.h;sys/ipc.h;sys/sem.h" HAVE_SEMTIMEDOP) # Some libc versions on Linux distributions don't have it +# Likely unused, because it contained typo's if(HAVE_PTHREAD_H) - check_function_exits("pthread_kill" HAVE_PTHREAD_KILL) - check_function_exits("pthread_sigmask" HAVE_PTHREAD_SIGMASK) + check_function_exists("pthread_kill" HAVE_PTHREAD_KILL) + check_function_exists("pthread_sigmask" HAVE_PTHREAD_SIGMASK) endif() # On C99, but we have to calculate the size check_type_size(size_t SIZEOF_SIZE_T LANGUAGE C) set(SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}) if(HAVE_NETDB_H) - set(CMAKE_EXTRA_INCLUDE_FILES "netdb.h" "unistd.h") + set(CMAKE_EXTRA_INCLUDE_FILES "netdb.h" "unistd.h") endif() if(HAVE_WINSOCK_H) - set(CMAKE_EXTRA_INCLUDE_FILES "winsock.h") + set(CMAKE_EXTRA_INCLUDE_FILES "winsock.h") endif() check_type_size(socklen_t HAVE_SOCKLEN_T LANGUAGE C) @@ -184,7 +185,7 @@ set(HAVE_VALGRIND ${VALGRIND_FOUND}) set(SOCKET_LIBRARIES "") if (WIN32) - set(SOCKET_LIBRARIES "ws2_32") + set(SOCKET_LIBRARIES "ws2_32") endif() cmake_push_check_state() @@ -201,10 +202,10 @@ if(COMMONCRYPTO_FOUND) add_library(OpenSSL::Crypto UNKNOWN IMPORTED) set_target_properties(OpenSSL::Crypto PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${COMMONCRYPTO_INCLUDE_DIR}") + INTERFACE_INCLUDE_DIRECTORIES "${COMMONCRYPTO_INCLUDE_DIR}") set_target_properties(OpenSSL::Crypto PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${COMMONCRYPTO_LIBRARIES}") + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${COMMONCRYPTO_LIBRARIES}") endif() if(OPENSSL_FOUND) #set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCUDE_DIR}") diff --git a/Release.md b/Release.md --- a/Release.md +++ b/Release.md @@ -11,7 +11,7 @@ There are 3 different sets of versions: - The monetdb version number - The monetb libraries version numbers -The version description is "unreleased", unless there is an actual release. Than is contains the name, for example "Nov2019-SP3". The monetdb version number is the version of the entire application, previously managed with vertoo. It contains three parts, a major, minor and release number. The release number is even during development and incremented to even for the actual release version. +The version description is "unreleased", unless there is an actual release. Than it contains the name, for example "Nov2019-SP3". The monetdb version number is the version of the entire application, previously managed with vertoo. It contains three parts, a major, minor and release number. The release number is even during development and incremented to even for the actual release version. ## Building a release When doing a release build, the only extra thing to do is to add the "-DRELEASE_VERSION=ON" parameter to the cmake command. This will make sure that the build will use the required version string and numbers. After building a successful release the final step is to tag the current version of the code in the release branch. Then you can start the next release by incrementing the "release" number of the monetdb version by 2. Or if necessary, create a new release branch. diff --git a/cmake/monetdb-findpackages.cmake b/cmake/monetdb-findpackages.cmake --- a/cmake/monetdb-findpackages.cmake +++ b/cmake/monetdb-findpackages.cmake @@ -6,7 +6,10 @@ # Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. #]] +# Detect required packages find_package(BISON REQUIRED) +find_package(Iconv) +find_package(Threads) if(${CMAKE_VERSION} VERSION_LESS "3.14.0") find_package(Python3 COMPONENTS Interpreter Development) @@ -28,8 +31,6 @@ if(WIN32) find_library(GETOPT_LIB "getopt.lib") endif() -find_package(Iconv) - if(WITH_LZMA) find_package(LibLZMA) @@ -41,24 +42,20 @@ if(WITH_LZMA) IMPORTED_LINK_INTERFACE_LANGUAGES C IMPORTED_LOCATION ${LIBLZMA_LIBRARY}) endif() - set(HAVE_LIBLZMA "${LZMA_FOUND}") endif () - endif() if(WITH_XML2) find_package(LibXml2) - set(HAVE_LIBXML "${LIBXML2_FOUND}") endif() -find_package(Threads) + if(WITH_PCRE) find_package(PCRE) - set(HAVE_PCRE "${PCRE_FOUND}") else() check_symbol_exists("regcomp" "regex.h" HAVE_POSIX_REGEX) endif() if(NOT PCRE_FOUND AND NOT HAVE_POSIX_REGEX) - message(FATAL_ERROR "PCRE library or GNU regex library not found but required for MonetDB5") + message(FATAL_ERROR "PCRE library or GNU regex library not found but required for MonetDB5") endif() if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") @@ -66,35 +63,39 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin else() find_package(OpenSSL) endif() + if(WITH_BZ2) find_package(BZip2) - set(HAVE_LIBBZ2 "${BZ2_FOUND}") endif() + if(WITH_CURL) find_package(CURL CONFIG) - set(HAVE_CURL "${CURL_FOUND}") endif() + if(WITH_ZLIB) find_package(ZLIB) - set(HAVE_LIBZ "${ZLIB_FOUND}") endif() + if(WITH_LZ4) find_package(LZ4) - set(HAVE_LIBLZ4 "${LZ4_FOUND}") endif() + if(WITH_PROJ) find_package(Proj) - set(HAVE_PROJ "${PROJ_FOUND}") endif() + if(WITH_SNAPPY) find_package(Snappy CONFIG) endif() + if(WITH_UUID) find_package(UUID) endif() + if(WITH_VALGRIND) find_package(Valgrind) endif() + if(WITH_READLINE) find_package(Readline) set(HAVE_READLINE "${READLINE_FOUND}") @@ -102,7 +103,6 @@ endif() if(FITS) find_package(CFitsIO) - set(HAVE_FITS "${CFITSIO_FOUND}") endif() if(CINTEGRATION) @@ -110,25 +110,24 @@ if(CINTEGRATION) endif() if(NETCDF) - find_package(NetCDF) - if(NETCDF_FOUND) - set(NETCDF_MINIMUM_VERSION "4.2") - if(NETCDF_VERSION VERSION_LESS "${NETCDF_MINIMUM_VERSION}") - if(${WITH_NETCDF} STREQUAL "YES") - message(FATAL_ERROR "netcdf library found, but the version is too old: ${NETCDF_VERSION} < ${NETCDF_MINIMUM_VERSION}") - else() - message(STATUS "netcdf library found, but the version is too old: ${NETCDF_VERSION} < ${NETCDF_MINIMUM_VERSION}") - endif() - else() - set(HAVE_NETCDF "${NETCDF_FOUND}") - endif() - #else() - #message(FATAL_ERROR "netcdf library required for NetCDF support") - endif() + find_package(NetCDF) + if(NETCDF_FOUND) + set(NETCDF_MINIMUM_VERSION "4.2") + if(NETCDF_VERSION VERSION_LESS "${NETCDF_MINIMUM_VERSION}") + if(${WITH_NETCDF} STREQUAL "YES") + message(FATAL_ERROR "netcdf library found, but the version is too old: ${NETCDF_VERSION} < ${NETCDF_MINIMUM_VERSION}") + else() + message(STATUS "netcdf library found, but the version is too old: ${NETCDF_VERSION} < ${NETCDF_MINIMUM_VERSION}") + endif() + else() + set(HAVE_NETCDF "${NETCDF_FOUND}") + endif() + #else() + #message(FATAL_ERROR "netcdf library required for NetCDF support") + endif() endif() find_package(KVM) -set(HAVE_KVM "${KVM_FOUND}") if(GEOM) find_package(Geos) @@ -191,8 +190,8 @@ if(RINTEGRATION) set(RHOME "${LIBR_HOME}") endif() -cmake_push_check_state() if(INT128) + cmake_push_check_state() check_type_size(__int128 SIZEOF___INT128 LANGUAGE C) check_type_size(__int128_t SIZEOF___INT128_T LANGUAGE C) check_type_size(__uint128_t SIZEOF___UINT128_T LANGUAGE C) @@ -201,141 +200,113 @@ if(INT128) message(STATUS "Huge integers are available") else() message(STATUS "128-bit integers not supported by this compiler") - #message(FATAL_ERROR "128-bit integers not supported by this compiler") + endif() + cmake_pop_check_state() +endif() + +if(SANITIZER) + if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU") + MT_addCompilerFlag("-fsanitize=address" "-fsanitize=address" "${CMAKE_C_FLAGS}" "all" CMAKE_C_FLAGS) + MT_addCompilerFlag("-fno-omit-frame-pointer" "-fsanitize=address" "${CMAKE_C_FLAGS}" "all" CMAKE_C_FLAGS) + add_definitions(-DNO_ATOMIC_INSTRUCTIONS) + else() + message(FATAL_ERROR "Sanitizer only supported with GCC") endif() endif() -cmake_pop_check_state() - -function(MT_addCompilerFlag REGEX_EXPRESSION FLAG_TO_ADD OLD_FLAGS BUILD NEW_FLAGS) - if(NOT "${OLD_FLAGS}" MATCHES "${REGEX_EXPRESSION}") - set(${NEW_FLAGS} "${OLD_FLAGS} ${FLAG_TO_ADD}" PARENT_SCOPE) - message(STATUS "Added ${FLAG_TO_ADD} flag for ${BUILD} build(s)") - endif() -endfunction() - -function(MT_checkCompilerFlag Flag) # WARNING this doesn't work with LINK_OPTIONS yet! - if(NOT "${CMAKE_C_FLAGS}" MATCHES "${Flag}") - string(REGEX REPLACE "[-/=,]" "" FLAG_TEST "${Flag}") # cmake will get confused if we don't remove - / = , - cmake_push_check_state() - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${Flag}") - check_c_source_compiles("int main(int argc,char** argv){(void)argc;(void)argv;return 0;}" COMPILER_${FLAG_TEST}) - cmake_pop_check_state() - if(COMPILER_${FLAG_TEST}) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${Flag}" PARENT_SCOPE) - message(STATUS "Added ${Flag} flag for all build(s)") - endif() - endif() -endfunction() - -if(SANITIZER) - if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU") - MT_addCompilerFlag("-fsanitize=address" "-fsanitize=address" "${CMAKE_C_FLAGS}" "all" CMAKE_C_FLAGS) - MT_addCompilerFlag("-fno-omit-frame-pointer" "-fsanitize=address" "${CMAKE_C_FLAGS}" "all" CMAKE_C_FLAGS) - add_definitions(-DNO_ATOMIC_INSTRUCTIONS) - else() - message(FATAL_ERROR "Sanitizer only supported with GCC") - endif() -endif() - if(STRICT) - if(${CMAKE_C_COMPILER_ID} MATCHES "^GNU|Clang|AppleClang$") - MT_addCompilerFlag("-Werror" "-Werror" "${CMAKE_C_FLAGS}" "all" CMAKE_C_FLAGS) - MT_addCompilerFlag("-Wall" "-Wall" "${CMAKE_C_FLAGS}" "all" CMAKE_C_FLAGS) - MT_addCompilerFlag("-Wextra" "-Wextra" "${CMAKE_C_FLAGS}" "all" CMAKE_C_FLAGS) - MT_addCompilerFlag("-W" "-W" "${CMAKE_C_FLAGS}" "all" CMAKE_C_FLAGS) - MT_checkCompilerFlag("-Werror-implicit-function-declaration") + if(${CMAKE_C_COMPILER_ID} MATCHES "^GNU|Clang|AppleClang$") + MT_addCompilerFlag("-Werror" "-Werror" "${CMAKE_C_FLAGS}" "all" CMAKE_C_FLAGS) + MT_addCompilerFlag("-Wall" "-Wall" "${CMAKE_C_FLAGS}" "all" CMAKE_C_FLAGS) + MT_addCompilerFlag("-Wextra" "-Wextra" "${CMAKE_C_FLAGS}" "all" CMAKE_C_FLAGS) + MT_addCompilerFlag("-W" "-W" "${CMAKE_C_FLAGS}" "all" CMAKE_C_FLAGS) + MT_checkCompilerFlag("-Werror-implicit-function-declaration") - MT_checkCompilerFlag("-Wpointer-arith") - MT_checkCompilerFlag("-Wundef") - MT_checkCompilerFlag("-Wformat=2") - MT_checkCompilerFlag("-Wformat-overflow=1") - MT_checkCompilerFlag("-Wno-format-truncation") - MT_checkCompilerFlag("-Wno-format-nonliteral") - #MT_checkCompilerFlag("-Wformat-signedness") -- numpy messes this up _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list