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

Windows build fixes and replace error messages with warnings.


diffs (165 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -414,11 +414,11 @@ if(PY_RETURN_CODE EQUAL 0 AND PY_OUPUT_R
        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) # Python 2 has precedence
-               set(MAJOR_PYTHON "2")
+               set(MAJOR_PYTHON 2)
                set(HAVE_PYTHON2 YES)
                set(PY2_OUPUT_RES "${PY_OUPUT_RES}")
        elseif(NOT MAJOR_IS_PYTHON3 EQUAL -1)
-               set(MAJOR_PYTHON "3")
+               set(MAJOR_PYTHON 3)
                set(HAVE_PYTHON3 YES)
                set(PY3_OUPUT_RES "${PY_OUPUT_RES}")
        else()
@@ -431,7 +431,11 @@ endif()
 
 if(NOT ${PYTHON2} STREQUAL "NO")
        if(${PYTHON2} STREQUAL "AUTO")
-               set(PYTHON2_INTERPRETER "python2")
+               if(MAJOR_PYTHON EQUAL 2)
+                       set(PYTHON2_INTERPRETER "python")
+               else()
+                       set(PYTHON2_INTERPRETER "python2")
+               endif()
        else()
                set(PYTHON2_INTERPRETER "${PYTHON2}/python2")
        endif()
@@ -444,7 +448,7 @@ if(NOT ${PYTHON2} STREQUAL "NO")
                                if(${PYTHON2} STREQUAL "YES")
                                        message(FATAL_ERROR " Python 2 
executable not found")
                                else()
-                                       message(ERROR " Python 2 executable not 
found")
+                                       message(WARN " Python 2 executable not 
found")
                                endif()
                        else()
                                set(HAVE_PYTHON2 YES)
@@ -455,7 +459,7 @@ if(NOT ${PYTHON2} STREQUAL "NO")
                        if(${PYTHON2} STREQUAL "YES")
                                message(FATAL_ERROR " Python 2 executable not 
found")
                        else()
-                               message(ERROR " Python 2 executable not found")
+                               message(WARN " Python 2 executable not found")
                        endif()
                endif()
        endif()
@@ -468,7 +472,7 @@ if(NOT ${PYTHON2} STREQUAL "NO")
                        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)")
+                               message(WARN " Python 2 executable is too old 
(<2.6)")
                        endif()
                endif()
        endif()
@@ -479,7 +483,7 @@ if(NOT ${PYTHON2} STREQUAL "NO")
                        if(${PYTHON2} STREQUAL "YES")
                                message(FATAL_ERROR " Must specify 
PYTHON2_LIBDIR when cross compiling")
                        else()
-                               message(ERROR " Must specify PYTHON2_LIBDIR 
when cross compiling")
+                               message(WARN " 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)
@@ -499,7 +503,7 @@ if(NOT ${PYTHON2} STREQUAL "NO")
                elseif(${PYTHON2} STREQUAL "YES")
                        message(FATAL_ERROR " Could not find PYTHON2_LIBDIR")
                else()
-                       message(ERROR " Could not find PYTHON2_LIBDIR")
+                       message(WARN " Could not find PYTHON2_LIBDIR")
                endif()
        endif()
 else()
@@ -508,7 +512,11 @@ endif()
 
 if(NOT ${PYTHON3} STREQUAL "NO")
        if(${PYTHON3} STREQUAL "AUTO")
-               set(PYTHON3_INTERPRETER "python3")
+               if(MAJOR_PYTHON EQUAL 3)
+                       set(PYTHON3_INTERPRETER "python")
+               else()
+                       set(PYTHON3_INTERPRETER "python3")
+               endif()
        else()
                set(PYTHON3_INTERPRETER "${PYTHON3}/python3")
        endif()
@@ -521,7 +529,7 @@ if(NOT ${PYTHON3} STREQUAL "NO")
                                if(${PYTHON3} STREQUAL "YES")
                                        message(FATAL_ERROR " Python 3 
executable not found")
                                else()
-                                       message(ERROR " Python 3 executable not 
found")
+                                       message(WARN " Python 3 executable not 
found")
                                endif()
                        else()
                                set(HAVE_PYTHON3 YES)
@@ -532,7 +540,7 @@ if(NOT ${PYTHON3} STREQUAL "NO")
                        if(${PYTHON3} STREQUAL "YES")
                                message(FATAL_ERROR " Python 3 executable not 
found")
                        else()
-                               message(ERROR " Python 3 executable not found")
+                               message(WARN " Python 3 executable not found")
                        endif()
                endif()
        endif()
@@ -545,7 +553,7 @@ if(NOT ${PYTHON3} STREQUAL "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)")
+                               message(WARN " Python 3 executable is too old 
(<3.5)")
                        endif()
                endif()
        endif()
@@ -556,7 +564,7 @@ if(NOT ${PYTHON3} STREQUAL "NO")
                        if(${PYTHON3} STREQUAL "YES")
                                message(FATAL_ERROR " Must specify 
PYTHON3_LIBDIR when cross compiling")
                        else()
-                               message(ERROR " Must specify PYTHON3_LIBDIR 
when cross compiling")
+                               message(WARN " Must specify PYTHON3_LIBDIR when 
cross compiling")
                        endif()
                endif()
                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)
@@ -569,7 +577,7 @@ if(NOT ${PYTHON3} STREQUAL "NO")
                elseif(${PYTHON3} STREQUAL "YES")
                        message(FATAL_ERROR " Could not find PYTHON3_LIBDIR")
                else()
-                       message(ERROR " Could not find PYTHON3_LIBDIR")
+                       message(WARN " Could not find PYTHON3_LIBDIR")
                endif()
        endif()
 else()
@@ -864,6 +872,8 @@ if(NOT ${WITH_UUID} STREQUAL "NO")
 endif()
 
 # OpenSSL or CommonCrypto library
+set(OPENSSL_INCS "")
+set(OPENSSL_LIBS "")
 if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
        set(HAVE_COMMONCRYPTO ON)
        set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};crypto") # 
TODO test this
@@ -899,10 +909,13 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin
 else()
        set(WITH_OPENSSL "YES" CACHE STRING "Include OpenSSL support 
(default=yes)") # Check with OPENSSL_FOUND
        if(NOT ${WITH_OPENSSL} STREQUAL "NO")
-               pkg_search_module(OPENSSL NO_CMAKE_PATH 
NO_CMAKE_ENVIRONMENT_PATH openssl)
+               find_package(OpenSSL)
 
                if(OPENSSL_FOUND)
                        message(STATUS "openssl library found")
+                       set(OPENSSL_INCS "${OPENSSL_INCLUDE_DIR}")
+                       set(OPENSSL_LIBS 
"${OPENSSL_SSL_LIBRARY};${OPENSSL_CRYPTO_LIBRARY}")
+                       set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCS}")
                        set(CMAKE_REQUIRED_LIBRARIES 
"${CMAKE_REQUIRED_LIBRARIES};ssl;crypto")
 
                        check_symbol_exists("MD5_Update" "openssl/md5.h" 
HAVE_MD5_UPDATE_FUNC)
@@ -956,6 +969,7 @@ else()
                endif()
        endif()
 endif()
+set(CMAKE_REQUIRED_INCLUDES "${PREV_CMAKE_REQUIRED_INCLUDES}")
 set(CMAKE_REQUIRED_LIBRARIES "${PREV_CMAKE_REQUIRED_LIBRARIES}")
 
 # Regex library
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to