Changeset: 133d17095996 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=133d17095996
Modified Files:
        CMakeLists.txt
        cmake/monetdb_config.h.in
Branch: cmake-fun
Log Message:

Aditional checks.


diffs (truncated from 880 to 300 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.4 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
 
 project(MonetDB C)
 
@@ -21,6 +21,8 @@ include(CheckTypeSize REQUIRED)
 include(FindIconv REQUIRED)
 include(TestLargeFiles REQUIRED)
 
+cmake_policy(SET CMP0075 NEW)
+
 function(defineCmacro OPTION VALUE)
        set(${OPTION} "#define ${VALUE}" PARENT_SCOPE)
 endfunction()
@@ -55,9 +57,10 @@ string(REGEX MATCH "STREAM_VERSION=[^\ \
 string(LENGTH ${STREAM_VERSION} STREAM_VERSION_LENGTH)
 string(SUBSTRING ${STREAM_VERSION} 15 STREAM_VERSION_LENGTH STREAM_VERSION)
 
-# Intel compiler hack
 if("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel")
-       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -no-gcc")
+       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -no-gcc") # Intel compiler hack
+elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
+       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE") # TODO 
CMAKE_REQUIRED_DEFINITIONS?
 endif()
 
 # Set default build options
@@ -84,8 +87,6 @@ if(NOT ${ENABLE_MAPI} STREQUAL "NO")
        defineCmacro(HAVE_MAPI "HAVE_MAPI 1")
 endif()
 
-set(ENABLE_ODBC "AUTO" CACHE STRING "Compile the MonetDB ODBC driver 
(default=auto)")
-
 set(ENABLE_GDK "YES" CACHE STRING "Enable support for GDK (default=yes)")
 
 set(ENABLE_MONETDB5 "YES" CACHE STRING "Enable support for MonetDB5 
(default=yes)")
@@ -132,10 +133,6 @@ if(NOT ${ENABLE_EMBEDDED} STREQUAL "NO")
        defineCmacro("HAVE_EMBEDDED" "HAVE_EMBEDDED 1")
 endif()
 
-set(ENABLE_RINTEGRATION "AUTO" CACHE STRING "Enable support for R integration 
into MonetDB (default=auto)")
-set(ENABLE_PY2INTEGRATION "AUTO" CACHE STRING "enable support for Python 2 
integration into MonetDB (default=auto)")
-set(ENABLE_PY3INTEGRATION "AUTO" CACHE STRING "enable support for Python 3 
integration into MonetDB (default=auto)")
-
 set(ENABLE_CONSOLE "YES" CACHE STRING "Enables direct console on the server 
(involves security risks) (default=yes)")
 if(NOT ${ENABLE_CONSOLE} STREQUAL "NO")
        defineCmacro("HAVE_CONSOLE" "HAVE_CONSOLE 1")
@@ -162,8 +159,8 @@ else()
 endif()
 
 # instalation directories
-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 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)")
 
 OPJ_TEST_LARGE_FILES(_LARGE_FILES)
 if(_LARGE_FILES)
@@ -411,19 +408,15 @@ if(${ENABLE_OPTIMIZE} STREQUAL "YES")
        checkCompilerFlag("-D_FORTIFY_SOURCE=2")
 endif()
 
-set(HAVE_PYTHON2 NO)
-set(HAVE_PYTHON3 NO)
-set(PYTHON2 "AUTO" CACHE STRING "python2 is installed as FILE")
-set(PYTHON3 "AUTO" CACHE STRING "python3 is installed as FILE")
-set(PYTHON2CONFIG "AUTO" CACHE STRING "python2-config is installed as FILE")
-set(PYTHON3CONFIG "AUTO" CACHE STRING "python3-config is installed as FILE")
+set(PYTHON2 "AUTO" CACHE STRING "python2 is installed in DIR")
+set(PYTHON3 "AUTO" CACHE STRING "python3 is installed in DIR")
 
 message(STATUS "Checking major version of Python interpreter")
 exec_program("python" ARGS "-V" OUTPUT_VARIABLE PY_OUPUT_RES RETURN_VALUE 
PY_RETURN_CODE)
 if(PY_RETURN_CODE EQUAL 0 AND PY_OUPUT_RES)
        string(FIND "${PY_OUPUT_RES}" "Python 2" MAJOR_IS_PYTHON2)
        string(FIND "${PY_OUPUT_RES}" "Python 3" MAJOR_IS_PYTHON3)
-       if(NOT MAJOR_IS_PYTHON2 EQUAL -1)
+       if(NOT MAJOR_IS_PYTHON2 EQUAL -1) # Python 2 has precedence
                set(MAJOR_PYTHON "2")
                set(HAVE_PYTHON2 YES)
                set(PY2_OUPUT_RES "${PY_OUPUT_RES}")
@@ -441,24 +434,32 @@ endif()
 
 if(NOT ${PYTHON2} STREQUAL "NO")
        if(${PYTHON2} STREQUAL "AUTO")
-               set(SEARCH_PYTHON2 "python2")
+               set(PYTHON2_INTERPRETER "python2")
        else()
-               set(SEARCH_PYTHON2 "${PYTHON2}")
+               set(PYTHON2_INTERPRETER "${PYTHON2}")
        endif()
 
        if(NOT CMAKE_CROSSCOMPILING)
-               exec_program("${SEARCH_PYTHON2}" ARGS "-V" OUTPUT_VARIABLE 
PY2_CUSTOM_OUPUT_RES RETURN_VALUE PY2_RETURN_CODE)
+               exec_program("${PYTHON2_INTERPRETER}" ARGS "-V" OUTPUT_VARIABLE 
PY2_CUSTOM_OUPUT_RES RETURN_VALUE PY2_RETURN_CODE)
                if(PY2_RETURN_CODE EQUAL 0 AND PY2_CUSTOM_OUPUT_RES)
                        string(FIND "${PY2_CUSTOM_OUPUT_RES}" "Python 2" 
HAS_PYTHON2)
                        if(HAS_PYTHON2 EQUAL -1)
-                               message(FATAL_ERROR " Custom python 2 
executable not found")
+                               if(${PYTHON2} STREQUAL "YES")
+                                       message(FATAL_ERROR " Python 2 
executable not found")
+                               else()
+                                       message(ERROR " Python 2 executable not 
found")
+                               endif()
                        else()
                                set(HAVE_PYTHON2 YES)
                                set(PY2_OUPUT_RES ${PY2_CUSTOM_OUPUT_RES})
                        endif()
                endif()
                if(NOT HAVE_PYTHON2)
-                       message(FATAL_ERROR " Python 2 executable not found")
+                       if(${PYTHON2} STREQUAL "YES")
+                               message(FATAL_ERROR " Python 2 executable not 
found")
+                       else()
+                               message(ERROR " Python 2 executable not found")
+                       endif()
                endif()
        endif()
 
@@ -466,21 +467,29 @@ if(NOT ${PYTHON2} STREQUAL "NO")
        string(SUBSTRING ${PY2_OUPUT_RES} 9 PY2_OUPUT_LENGTH PY2_VERSION)
        if(PY2_VERSION LESS 6)
                set(HAVE_PYTHON2 NO)
-               message(FATAL_ERROR " Python 2 executable is too old (<2.6)")
+               if(${PYTHON2} STREQUAL "YES")
+                       message(FATAL_ERROR " Python 2 executable is too old 
(<2.6)")
+               else()
+                       message(ERROR " Python 2 executable is too old (<2.6)")
+               endif()
        endif()
 
        set(PYTHON2_LIBDIR "AUTO" CACHE STRING "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)
-                       message(FATAL_ERROR " Must specify PYTHON2_LIBDIR when 
cross compiling")
+                       if(${PYTHON2} STREQUAL "YES")
+                               message(FATAL_ERROR " Must specify 
PYTHON2_LIBDIR when cross compiling")
+                       else()
+                               message(ERROR " Must specify PYTHON2_LIBDIR 
when cross compiling")
+                       endif()
                endif()
                if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" AND 
CMAKE_SYSTEM_VERSION VERSION_EQUAL 9 AND PY2_VERSION VERSION_EQUAL 2.5)
-                       exec_program("${SEARCH_PYTHON2}" ARGS "-c 'import 
distutils.sysconfig; print 
distutils.sysconfig.get_python_lib(0,1,\"${CMAKE_INSTALL_PREFIX}\")' 
2>/dev/null" OUTPUT_VARIABLE PYTHON2_LIBDIR RETURN_VALUE PYTHON2_LIBDIR_CODE) # 
TODO Escape this
+                       exec_program("${PYTHON2_INTERPRETER}" ARGS "-c 'import 
distutils.sysconfig; print 
distutils.sysconfig.get_python_lib(0,1,\"${CMAKE_INSTALL_PREFIX}\")'" 
OUTPUT_VARIABLE PYTHON2_LIBDIR RETURN_VALUE PYTHON2_LIBDIR_CODE) # TODO Escape 
this
                        if(PYTHON2_LIBDIR)
                                set(PYTHON2_LIBDIR 
"${PYTHON2_LIBDIR}/site-packages") # Runs on a POSIX platform, so it's safe to 
do
                        endif()
                else()
-                       exec_program("${SEARCH_PYTHON2}" ARGS "-c 'import 
distutils.sysconfig; print 
distutils.sysconfig.get_python_lib(0,0,\"${CMAKE_INSTALL_PREFIX}\")' 
2>/dev/null" OUTPUT_VARIABLE PYTHON2_LIBDIR RETURN_VALUE PYTHON2_LIBDIR_CODE) # 
TODO Escape this
+                       exec_program("${PYTHON2_INTERPRETER}" ARGS "-c 'import 
distutils.sysconfig; print 
distutils.sysconfig.get_python_lib(0,0,\"${CMAKE_INSTALL_PREFIX}\")'" 
OUTPUT_VARIABLE PYTHON2_LIBDIR RETURN_VALUE PYTHON2_LIBDIR_CODE) # TODO Escape 
this
                endif()
 
                if(PYTHON2_LIBDIR AND PYTHON2_LIBDIR_CODE EQUAL 0)
@@ -488,8 +497,10 @@ if(NOT ${PYTHON2} STREQUAL "NO")
                        math(EXPR CMAKE_INSTALL_PREFIX_LENGTH 
"${CMAKE_INSTALL_PREFIX_LENGTH}+1") # add the / separator
                        string(LENGTH PYTHON2_LIBDIR 
PYTHON2_LIBDIR_PREFIX_LENGTH)
                        string(SUBSTRING ${PYTHON2_LIBDIR} 
${CMAKE_INSTALL_PREFIX_LENGTH} PYTHON2_LIBDIR_PREFIX_LENGTH PYTHON2_LIBDIR) # 
remove the prefix
+               elseif(${PYTHON2} STREQUAL "YES")
+                       message(FATAL_ERROR " Could not find PYTHON2_LIBDIR")
                else()
-                       message(FATAL_ERROR " Could not find PYTHON2_LIBDIR")
+                       message(ERROR " Could not find PYTHON2_LIBDIR")
                endif()
        endif()
 else()
@@ -498,41 +509,66 @@ endif()
 
 if(NOT ${PYTHON3} STREQUAL "NO")
        if(${PYTHON3} STREQUAL "AUTO")
-               set(SEARCH_PYTHON3 "python3")
+               set(PYTHON3_INTERPRETER "python3")
        else()
-               set(SEARCH_PYTHON3 "${PYTHON3}")
+               set(PYTHON3_INTERPRETER "${PYTHON3}")
        endif()
 
        if(NOT CMAKE_CROSSCOMPILING)
-               exec_program("${SEARCH_PYTHON3}" ARGS "-V" OUTPUT_VARIABLE 
PY3_CUSTOM_OUPUT_RES RETURN_VALUE PY3_RETURN_CODE)
+               exec_program("${PYTHON3_INTERPRETER}" ARGS "-V" OUTPUT_VARIABLE 
PY3_CUSTOM_OUPUT_RES RETURN_VALUE PY3_RETURN_CODE)
                if(PY3_RETURN_CODE EQUAL 0 AND PY3_CUSTOM_OUPUT_RES)
                        string(FIND "${PY3_CUSTOM_OUPUT_RES}" "Python 3" 
HAS_PYTHON3)
                        if(HAS_PYTHON3 EQUAL -1)
-                               message(FATAL_ERROR " Custom python 3 
executable not found")
+                               if(${PYTHON3} STREQUAL "YES")
+                                       message(FATAL_ERROR " Python 3 
executable not found")
+                               else()
+                                       message(ERROR " Python 3 executable not 
found")
+                               endif()
                        else()
                                set(HAVE_PYTHON3 YES)
                                set(PY3_OUPUT_RES ${PY3_CUSTOM_OUPUT_RES})
                        endif()
                endif()
                if(NOT HAVE_PYTHON3)
-                       message(FATAL_ERROR " Python 3 executable not found")
+                       if(${PYTHON3} STREQUAL "YES")
+                               message(FATAL_ERROR " Python 3 executable not 
found")
+                       else()
+                               message(ERROR " Python 3 executable not found")
+                       endif()
+               endif()
+       endif()
+
+       string(LENGTH PY3_OUPUT_RES PY3_OUPUT_LENGTH)
+       string(SUBSTRING ${PY3_OUPUT_RES} 9 PY3_OUPUT_LENGTH PY3_VERSION)
+       if(PY3_VERSION LESS 5)
+               set(HAVE_PYTHON3 NO)
+               if(${PYTHON3} STREQUAL "YES")
+                       message(FATAL_ERROR " Python 3 executable is too old 
(<3.5)")
+               else()
+                       message(ERROR " Python 3 executable is too old (<3.5)")
                endif()
        endif()
 
        set(PYTHON3_LIBDIR "AUTO" CACHE STRING "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)
-                       message(FATAL_ERROR " Must specify PYTHON3_LIBDIR when 
cross compiling")
+                       if(${PYTHON3} STREQUAL "YES")
+                               message(FATAL_ERROR " Must specify 
PYTHON3_LIBDIR when cross compiling")
+                       else()
+                               message(ERROR " Must specify PYTHON3_LIBDIR 
when cross compiling")
+                       endif()
                endif()
-               exec_program("${SEARCH_PYTHON3}" ARGS "-c 'import 
distutils.sysconfig; 
print(distutils.sysconfig.get_python_lib(0,0,\"${CMAKE_INSTALL_PREFIX}\"))' 
2>/dev/null" OUTPUT_VARIABLE PYTHON3_LIBDIR RETURN_VALUE PYTHON3_LIBDIR_CODE)
+               exec_program("${PYTHON3_INTERPRETER}" ARGS "-c 'import 
distutils.sysconfig; 
print(distutils.sysconfig.get_python_lib(0,0,\"${CMAKE_INSTALL_PREFIX}\"))'" 
OUTPUT_VARIABLE PYTHON3_LIBDIR RETURN_VALUE PYTHON3_LIBDIR_CODE)
 
                if(PYTHON3_LIBDIR AND PYTHON3_LIBDIR_CODE EQUAL 0)
                        string(LENGTH CMAKE_INSTALL_PREFIX 
CMAKE_INSTALL_PREFIX_LENGTH)
                        math(EXPR CMAKE_INSTALL_PREFIX_LENGTH 
"${CMAKE_INSTALL_PREFIX_LENGTH}+1") # add the / separator
                        string(LENGTH PYTHON3_LIBDIR 
PYTHON3_LIBDIR_PREFIX_LENGTH)
                        string(SUBSTRING ${PYTHON3_LIBDIR} 
${CMAKE_INSTALL_PREFIX_LENGTH} PYTHON3_LIBDIR_PREFIX_LENGTH PYTHON3_LIBDIR) # 
remove the prefix
+               elseif(${PYTHON3} STREQUAL "YES")
+                       message(FATAL_ERROR " Could not find PYTHON3_LIBDIR")
                else()
-                       message(FATAL_ERROR " Could not find PYTHON3_LIBDIR")
+                       message(ERROR " Could not find PYTHON3_LIBDIR")
                endif()
        endif()
 else()
@@ -602,18 +638,16 @@ set(PREV_CMAKE_REQUIRED_LIBRARIES "${CMA
 set(PREV_CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES}")
 set(PREV_CMAKE_REQUIRED_LINK_OPTIONS "${CMAKE_REQUIRED_LINK_OPTIONS}")
 set(PREV_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+set(PREV_CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_EXTRA_INCLUDE_FILES}")
 
 set(WITH_BZ2 "AUTO" CACHE STRING "Include bz2 support (default=auto)")
 if(NOT ${WITH_BZ2} STREQUAL "NO")
        pkg_search_module(BZIP2 NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH bzip2)
 
        if(BZIP2_FOUND)
-               check_include_file("bzlib.h" HAVE_BZLIB)
-               if(HAVE_BZLIB)
-                       set(CMAKE_REQUIRED_LIBRARIES 
"${CMAKE_REQUIRED_LIBRARIES};bz2")
-                       check_symbol_exists("BZ2_bzopen" "bzlib.h" HAVE_BZLIB)
-                       set(CMAKE_REQUIRED_LIBRARIES 
"${PREV_CMAKE_REQUIRED_LIBRARIES}")
-               endif()
+               set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};bz2")
+               check_symbol_exists("BZ2_bzopen" "bzlib.h" HAVE_BZLIB)
+               set(CMAKE_REQUIRED_LIBRARIES "${PREV_CMAKE_REQUIRED_LIBRARIES}")
        endif()
        if(HAVE_BZLIB)
                message(STATUS "bz2 library found")
@@ -634,12 +668,10 @@ if(NOT ${WITH_SNAPPY} STREQUAL "NO")
        if(SNAPPY_FOUND)
                message(STATUS "snappy library found")
                defineCmacro("HAVE_LIBSNAPPY" "HAVE_LIBSNAPPY 1")
+       elseif(${WITH_SNAPPY} STREQUAL "YES")
+               message(FATAL_ERROR "snappy library not found")
        else()
-               if(${WITH_SNAPPY} STREQUAL "YES")
-                       message(FATAL_ERROR "snappy library not found")
-               else()
-                       message(ERROR " snappy library not found")
-               endif()
+               message(ERROR " snappy library not found")
        endif()
 endif()
 
@@ -650,12 +682,10 @@ if(NOT ${WITH_LZ4} STREQUAL "NO")
        if(LZ4_FOUND)
                message(STATUS "lz4 library found")
                defineCmacro("HAVE_LIBLZ4" "HAVE_LIBLZ4 1")
+       elseif(${WITH_LZ4} STREQUAL "YES")
+               message(FATAL_ERROR "lz4 library not found")
        else()
-               if(${WITH_LZ4} STREQUAL "YES")
-                       message(FATAL_ERROR "lz4 library not found")
-               else()
-                       message(ERROR " lz4 library not found")
-               endif()
+               message(ERROR " lz4 library not found")
        endif()
 endif()
 
@@ -756,33 +786,26 @@ if(NOT ${WITH_READLINE} STREQUAL "NO")
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to