Changeset: 86585ac9f880 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=86585ac9f880 Added Files: cmake/FindCfitsio.cmake cmake/FindLZ4.cmake cmake/FindNetCDF.cmake cmake/FindProj.cmake cmake/FindSnappy.cmake cmake/FindValgrind.cmake Modified Files: CMakeLists.txt clients/mapiclient/CMakeLists.txt clients/mapilib/CMakeLists.txt cmake/FindPCRE.cmake common/stream/CMakeLists.txt common/utils/CMakeLists.txt gdk/CMakeLists.txt monetdb5/mal/CMakeLists.txt monetdb5/modules/atoms/CMakeLists.txt monetdb5/modules/mal/CMakeLists.txt monetdb5/tools/CMakeLists.txt sql/backends/monet5/CMakeLists.txt testing/CMakeLists.txt testing/Mtest.py.in tools/merovingian/client/CMakeLists.txt tools/merovingian/daemon/CMakeLists.txt tools/merovingian/utils/CMakeLists.txt tools/mserver/CMakeLists.txt Branch: cmake-fun Log Message:
Major improvements: - Pkg-config is no longer required, thus more portability is granted. Instead we look optional libraries ourselves. - Set libraries include dir and library name variables uniform across all libraries. - Throw STATUS messages instead of WARNING messages in many places. - Fixed LINK_OPTIONS check for multiple runs. diffs (truncated from 1642 to 300 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,9 +12,7 @@ project(MonetDB C) set(C_STANDARD_REQUIRED ON) set(CMAKE_C_STANDARD 99) -set(PACKAGE "MonetDB" CACHE STRING "") - -find_package(PkgConfig) +set(PACKAGE "MonetDB" CACHE STRING "MonetDB, SQL queries at light speed") set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" CACHE INTERNAL "Location of custom CMake modules.") include(CheckCCompilerFlag REQUIRED) @@ -33,7 +31,6 @@ cmake_policy(SET CMP0075 NEW) # Save default cmake options in the begining set(PREV_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}") -set(NEW_LINK_OPTIONS "${LINK_OPTIONS}") function(MT_clibsToCmake INPUT_INCS OUTPUT_INCS) # Remove -I before the include path string(LENGTH "${INPUT_INCS}" INPUT_INCS_LENGTH) @@ -106,14 +103,14 @@ else() endif() # modules to use -set(ENABLE_MAPI "YES" CACHE STRING "Enable MAPI (default=yes)") +set(ENABLE_MAPI "YES" CACHE STRING "Enable MAPI (default=YES)") if(NOT ${ENABLE_MAPI} STREQUAL "NO") set(HAVE_MAPI ON) endif() -set(ENABLE_GDK "YES" CACHE STRING "Enable support for GDK (default=yes)") +set(ENABLE_GDK "YES" CACHE STRING "Enable support for GDK (default=YES)") -set(ENABLE_MONETDB5 "YES" CACHE STRING "Enable support for MonetDB5 (default=yes)") +set(ENABLE_MONETDB5 "YES" CACHE STRING "Enable support for MonetDB5 (default=YES)") if(${ENABLE_GDK} STREQUAL "NO") if(${ENABLE_MONETDB5} STREQUAL "YES") message(FATAL_ERROR "MonetDB5 requires GDK.") @@ -124,7 +121,7 @@ else() set(HAVE_GDK ON) endif() -set(ENABLE_SQL "YES" CACHE STRING "Enable support for MonetDB/SQL (default=yes)") +set(ENABLE_SQL "YES" CACHE STRING "Enable support for MonetDB/SQL (default=YES)") if(${ENABLE_MONETDB5} STREQUAL "NO") if(${ENABLE_SQL} STREQUAL "YES") message(FATAL_ERROR "MonetDB/SQL requires MonetDB5.") @@ -133,7 +130,7 @@ if(${ENABLE_MONETDB5} STREQUAL "NO") endif() endif() -set(ENABLE_GEOM "AUTO" CACHE STRING "Enable support for geom module (default=auto)") +set(ENABLE_GEOM "AUTO" CACHE STRING "Enable support for geom module (default=AUTO)") if(${ENABLE_MONETDB5} STREQUAL "NO") if(${ENABLE_GEOM} STREQUAL "YES") message(FATAL_ERROR "Geom module requires MonetDB5.") @@ -142,8 +139,8 @@ if(${ENABLE_MONETDB5} STREQUAL "NO") endif() endif() -set(ENABLE_LIDAR "AUTO" CACHE STRING "Enable support for LiDAR data (default=auto)") -set(ENABLE_SHP "AUTO" CACHE STRING "Enable support for ESRI Shapefiles (default=auto)") +set(ENABLE_LIDAR "AUTO" CACHE STRING "Enable support for LiDAR data (default=AUTO)") +set(ENABLE_SHP "AUTO" CACHE STRING "Enable support for ESRI Shapefiles (default=AUTO)") if(${ENABLE_GEOM} STREQUAL "NO") if(${ENABLE_SHP} STREQUAL "YES") message(FATAL_ERROR "ESRI Shapefile vault requires the geom module.") @@ -154,20 +151,20 @@ else() set(HAVE_GEOM ON) endif() -set(ENABLE_EMBEDDED "NO" CACHE STRING "Enable support for running MonetDB as a library (default=no)") +set(ENABLE_EMBEDDED "NO" CACHE STRING "Enable support for running MonetDB as a library (default=NO)") if(NOT ${ENABLE_EMBEDDED} STREQUAL "NO") set(HAVE_EMBEDDED ON) endif() -set(ENABLE_CONSOLE "YES" CACHE STRING "Enables direct console on the server (involves security risks) (default=yes)") +set(ENABLE_CONSOLE "YES" CACHE STRING "Enables direct console on the server (involves security risks) (default=YES)") if(NOT ${ENABLE_CONSOLE} STREQUAL "NO") set(HAVE_CONSOLE ON) endif() -set(ENABLE_ASSERT "${DFT_ASSERT}" CACHE STRING "Enable assertions in the code (default=yes for development sources)") -set(ENABLE_STRICT "${DFT_STRICT}" CACHE STRING "Enable strict compiler flags (default=yes for development sources)") -set(ENABLE_SANITIZER "NO" CACHE STRING "Enable support for the GCC address sanitizer (default=no)") -set(ENABLE_DEVELOPER "${DFT_DEVELOPER}" CACHE STRING "Enable full debugging (default=yes for development sources)") +set(ENABLE_ASSERT "${DFT_ASSERT}" CACHE STRING "Enable assertions in the code (default=YES for development sources, NO for tarball instalation)") +set(ENABLE_STRICT "${DFT_STRICT}" CACHE STRING "Enable strict compiler flags (default=YES for development sources, NO for tarball instalation)") +set(ENABLE_SANITIZER "NO" CACHE STRING "Enable support for the GCC address sanitizer (default=NO)") +set(ENABLE_DEVELOPER "${DFT_DEVELOPER}" CACHE STRING "Enable full debugging (default=YES for development sources, NO for tarball instalation)") if(NOT ${ENABLE_DEVELOPER} STREQUAL "NO") set(HAVE_DEVELOPER ON) endif() @@ -179,8 +176,8 @@ endif() if(UNIX OR APPLE) # instalation directories. This has to come earlier include(GNUInstallDirs REQUIRED) - set(LOGDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/monetdb" CACHE STRING "Where to put log files (LOCALSTATEDIR/log/monetdb)") - set(RUNDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/run/monetdb" CACHE STRING "Where to put pid files (LOCALSTATEDIR/run/monetdb)") + set(LOGDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/monetdb" CACHE PATH "Where to put log files (LOCALSTATEDIR/log/monetdb)") + set(RUNDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/run/monetdb" CACHE PATH "Where to put pid files (LOCALSTATEDIR/run/monetdb)") set(BINDIR "${CMAKE_INSTALL_FULL_BINDIR}") set(DATADIR "${CMAKE_INSTALL_FULL_DATADIR}") set(DATA_DIR "${CMAKE_INSTALL_FULL_DATADIR}") @@ -321,6 +318,12 @@ function(addCompilerFlag REGEX_EXPRESSIO message(STATUS "Added ${FLAG_TO_ADD} flag for ${BUILD} build(s)") endif() endfunction() +function(addLinkerFlag REGEX_EXPRESSION FLAG_TO_ADD OLD_FLAGS 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") + endif() +endfunction() if(${ENABLE_ASSERT} STREQUAL "NO") set(NDEBUG ON) @@ -457,12 +460,15 @@ if(${ENABLE_STRICT} STREQUAL "YES") endif() elseif(${CMAKE_C_COMPILER_ID} STREQUAL "Intel") if(CMAKE_C_COMPILER_VERSION VERSION_LESS 10) - set(NEW_LINK_OPTIONS "${NEW_LINK_OPTIONS} -i_dynamic") + addLinkerFlag("-i_dynamic" "-i_dynamic" "${LINK_OPTIONS}" LINK_OPTIONS) + addLinkerFlag("-i_dynamic" "-i_dynamic" "${STATIC_LIBRARY_OPTIONS}" STATIC_LIBRARY_OPTIONS) else() - set(NEW_LINK_OPTIONS "${NEW_LINK_OPTIONS} -shared-intel") + addLinkerFlag("-shared-intel" "-shared-intel" "${LINK_OPTIONS}" LINK_OPTIONS) + addLinkerFlag("-shared-intel" "-shared-intel" "${STATIC_LIBRARY_OPTIONS}" STATIC_LIBRARY_OPTIONS) endif() if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1 AND CMAKE_C_COMPILER_VERSION VERSION_LESS_EQUAL 11) - set(NEW_LINK_OPTIONS "${NEW_LINK_OPTIONS} -wd1418") + addLinkerFlag("-wd1418" "-wd1418" "${LINK_OPTIONS}" LINK_OPTIONS) + addLinkerFlag("-wd1418" "-wd1418" "${STATIC_LIBRARY_OPTIONS}" STATIC_LIBRARY_OPTIONS) endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -we140 -we147") if(CMAKE_C_COMPILER_VERSION VERSION_LESS 8 OR CMAKE_C_COMPILER_VERSION VERSION_GREATER 17) @@ -489,8 +495,9 @@ endif() if(NOT ${ENABLE_SANITIZER} STREQUAL "NO") if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") + string(TOLOWER "${ENABLE_SANITIZER}" ENABLE_SANITIZER_LOWER) checkCompilerFlag("-fsanitize=address") - checkCompilerFlag("-fsanitize=${ENABLE_SANITIZER}") + checkCompilerFlag("-fsanitize=${ENABLE_SANITIZER_LOWER}") checkCompilerFlag("-fno-omit-frame-pointer") add_compile_definitions(NO_ATOMIC_INSTRUCTIONS) else() @@ -498,16 +505,20 @@ if(NOT ${ENABLE_SANITIZER} STREQUAL "NO" endif() endif() -message(STATUS "Test if compiler supports -Wl,-Bsymbolic-functions flag") -cmake_push_check_state() -set(NEW_LINK_OPTIONS "${NEW_LINK_OPTIONS} -Wl,-Bsymbolic-functions") -check_c_compiler_flag("" HAVE_WL_BSYMBOLIC_FUNCTIONS) -if(NOT HAVE_WL_BSYMBOLIC_FUNCTIONS) - cmake_pop_check_state() +if(NOT "${LINK_OPTIONS}" MATCHES "-Wl,-Bsymbolic-function") + message(STATUS "Test if compiler supports -Wl,-Bsymbolic-functions flag") + set(PREV_LINK_OPTIONS "${LINK_OPTIONS}") + set(LINK_OPTIONS "${LINK_OPTIONS} -Wl,-Bsymbolic-functions") + check_c_compiler_flag("" HAVE_WL_BSYMBOLIC_FUNCTIONS) + if(HAVE_WL_BSYMBOLIC_FUNCTIONS) + set(STATIC_LIBRARY_OPTIONS "${STATIC_LIBRARY_OPTIONS} -Wl,-Bsymbolic-functions") + else() + set(LINK_OPTIONS "${PREV_LINK_OPTIONS}") + endif() endif() -set(PYTHON2 "AUTO" CACHE STRING "python2 is installed in DIR") -set(PYTHON3 "AUTO" CACHE STRING "python3 is installed in DIR") +set(PYTHON2 "AUTO" CACHE PATH "python2 is installed in DIR") +set(PYTHON3 "AUTO" CACHE PATH "python3 is installed in DIR") message(STATUS "Checking major version of Python interpreter") find_program(PYTHON_INTERPRETER python) if(PYTHON_INTERPRETER) @@ -532,7 +543,7 @@ if(PYTHON_INTERPRETER) endif() endif() else() - message(WARNING "A python interpreter was not found") + message(STATUS "A python interpreter was not found") endif() if(NOT ${PYTHON2} STREQUAL "NO") @@ -554,7 +565,7 @@ if(NOT ${PYTHON2} STREQUAL "NO") if(${PYTHON2} STREQUAL "YES") message(FATAL_ERROR "Python 2 executable not found") else() - message(WARNING " Python 2 executable not found") + message(STATUS "Python 2 executable not found") endif() else() set(HAVE_PYTHON2 YES) @@ -565,7 +576,7 @@ if(NOT ${PYTHON2} STREQUAL "NO") if(${PYTHON2} STREQUAL "YES") message(FATAL_ERROR "Python 2 executable not found") else() - message(WARNING " Python 2 executable not found") + message(STATUS "Python 2 executable not found") endif() endif() endif() @@ -578,18 +589,18 @@ if(NOT ${PYTHON2} STREQUAL "NO") if(${PYTHON2} STREQUAL "YES") message(FATAL_ERROR "Python 2 executable is too old (<2.6)") else() - message(WARNING " Python 2 executable is too old (<2.6)") + message(WARNING "Python 2 executable is too old (<2.6)") endif() endif() endif() - set(PYTHON2_LIBDIR "AUTO" CACHE STRING "Path for Python 2 library directory (where Python 2 modules should be installed)") + set(PYTHON2_LIBDIR "AUTO" CACHE PATH "Path for Python 2 library directory (where Python 2 modules should be installed)") if(${PYTHON2_LIBDIR} STREQUAL "YES" OR ${PYTHON2_LIBDIR} STREQUAL "AUTO") if(CMAKE_CROSSCOMPILING) if(${PYTHON2} STREQUAL "YES") message(FATAL_ERROR "Must specify PYTHON2_LIBDIR when cross compiling") else() - message(WARNING " Must specify PYTHON2_LIBDIR when cross compiling") + message(WARNING "Must specify PYTHON2_LIBDIR when cross compiling") endif() endif() if(APPLE AND CMAKE_SYSTEM_VERSION VERSION_EQUAL 9 AND PY2_VERSION VERSION_EQUAL 2.5) @@ -609,7 +620,7 @@ if(NOT ${PYTHON2} STREQUAL "NO") elseif(${PYTHON2} STREQUAL "YES") message(FATAL_ERROR "Could not find PYTHON2_LIBDIR") else() - message(WARNING " Could not find PYTHON2_LIBDIR") + message(WARNING "Could not find PYTHON2_LIBDIR") endif() endif() else() @@ -635,7 +646,7 @@ if(NOT ${PYTHON3} STREQUAL "NO") if(${PYTHON3} STREQUAL "YES") message(FATAL_ERROR "Python 3 executable not found") else() - message(WARNING " Python 3 executable not found") + message(STATUS "Python 3 executable not found") endif() else() set(HAVE_PYTHON3 YES) @@ -646,7 +657,7 @@ if(NOT ${PYTHON3} STREQUAL "NO") if(${PYTHON3} STREQUAL "YES") message(FATAL_ERROR "Python 3 executable not found") else() - message(WARNING " Python 3 executable not found") + message(STATUS "Python 3 executable not found") endif() endif() endif() @@ -659,18 +670,18 @@ if(NOT ${PYTHON3} STREQUAL "NO") if(${PYTHON3} STREQUAL "YES") message(FATAL_ERROR "Python 3 executable is too old (<3.5)") else() - message(WARNING " Python 3 executable is too old (<3.5)") + message(WARNING "Python 3 executable is too old (<3.5)") endif() endif() endif() - set(PYTHON3_LIBDIR "AUTO" CACHE STRING "Path for Python 3 library directory (where Python 3 modules should be installed)") + set(PYTHON3_LIBDIR "AUTO" CACHE PATH "Path for Python 3 library directory (where Python 3 modules should be installed)") if(${PYTHON3_LIBDIR} STREQUAL "YES" OR ${PYTHON3_LIBDIR} STREQUAL "AUTO") if(CMAKE_CROSSCOMPILING) if(${PYTHON3} STREQUAL "YES") message(FATAL_ERROR "Must specify PYTHON3_LIBDIR when cross compiling") else() - message(WARNING " Must specify PYTHON3_LIBDIR when cross compiling") + message(WARNING "Must specify PYTHON3_LIBDIR when cross compiling") endif() endif() exec_program("${PYTHON3_INTERPRETER}" ARGS "-c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(1,0,\"${LIBDIR}\"))'" OUTPUT_VARIABLE PYTHON3_LIBDIR RETURN_VALUE PYTHON3_LIBDIR_CODE) @@ -683,7 +694,7 @@ if(NOT ${PYTHON3} STREQUAL "NO") elseif(${PYTHON3} STREQUAL "YES") message(FATAL_ERROR "Could not find PYTHON3_LIBDIR") else() - message(WARNING " Could not find PYTHON3_LIBDIR") + message(WARNING "Could not find PYTHON3_LIBDIR") endif() endif() else() @@ -696,7 +707,7 @@ elseif(HAVE_PYTHON3) set(PYTHON_LIBDIR ${PYTHON3_LIBDIR}) endif() -set(ENABLE_TESTING "AUTO" CACHE STRING "Enable support for testing (default=auto)") +set(ENABLE_TESTING "AUTO" CACHE STRING "Enable support for testing (default=AUTO)") if(NOT ENABLE_TESTING STREQUAL "NO" AND NOT HAVE_PYTHON2 AND NOT HAVE_PYTHON3) set(ENABLE_TESTING "NO") endif() @@ -713,7 +724,7 @@ elseif(${ENABLE_SQL} STREQUAL "YES") message(FATAL_ERROR "MonetDB/SQL requires bison") else() set(ENABLE_SQL "NO") - message(WARNING " Bison not found") _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list