Changeset: 0e5ce3ae188e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0e5ce3ae188e
Modified Files:
        CMakeLists.txt
        CMakeReadme.txt
        monetdb5/extras/rapi/CMakeLists.txt
Branch: cmake-fun
Log Message:

We require cmake 3.1 on Windows.

Also check for compiler flag existence first.


diffs (43 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,7 +6,11 @@
 # Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
 #]]
 
-cmake_minimum_required(VERSION 3.0) # The $<TARGET_PDB_FILE:tgt> generator 
expression appears only on cmake 3.1, which causes problems on Windows with 
cmake 3.0
+if(WIN32)
+       cmake_minimum_required(VERSION 3.1) # The $<TARGET_PDB_FILE:tgt> 
generator expression appears on cmake 3.1
+else()
+       cmake_minimum_required(VERSION 3.0)
+endif()
 
 # Change these variables between releases
 set(MONETDB_VERSION_MAJOR "11")
diff --git a/CMakeReadme.txt b/CMakeReadme.txt
--- a/CMakeReadme.txt
+++ b/CMakeReadme.txt
@@ -1,3 +1,5 @@
+Cmake 3.1 is required on Windows, On all other platforms, cmake 3.0 suffices.
+On CentOS 6, enable epel repository, then install cmake3 package.
 While running the cmake command set internal variables to change the build 
properties in the form -D<var>=<value>
 
 - Variables intrinsic to Cmake that we set on our scripts
diff --git a/monetdb5/extras/rapi/CMakeLists.txt 
b/monetdb5/extras/rapi/CMakeLists.txt
--- a/monetdb5/extras/rapi/CMakeLists.txt
+++ b/monetdb5/extras/rapi/CMakeLists.txt
@@ -58,7 +58,13 @@ if(HAVE_LIBR)
        set_target_properties(rapi PROPERTIES OUTPUT_NAME _rapi)
        target_compile_definitions(rapi PRIVATE LIBRAPI)
        if(${CMAKE_C_COMPILER_ID} MATCHES "^GNU|Clang|AppleClang$")
-               target_compile_options(rapi PRIVATE -Wno-redundant-decls)
+               cmake_push_check_state()
+               set(CMAKE_REQUIRED_FLAGS 
"${CMAKE_REQUIRED_FLAGS};-Wno-redundant-decls")
+               check_c_source_compiles("int main(int argc,char** 
argv){(void)argc;(void)argv;return 0;}" COMPILER_Wnoredundantdecls) # Warning 
don't add '-' or '/' to the output variable!
+               cmake_pop_check_state()
+               if(COMPILER_Wnoredundantdecls)
+                       target_compile_options(rapi PRIVATE 
-Wno-redundant-decls)
+               endif()
        endif()
 
        install(TARGETS rapi DESTINATION ${LIBDIR}/monetdb5)
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to