diff --git a/CMakeLists.txt b/CMakeLists.txt index 91767f2481..a457409968 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,7 @@ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 4) endif() # Define minimum cmake version -cmake_minimum_required(VERSION 3.12 FATAL_ERROR) +cmake_minimum_required(VERSION 3.16.3 FATAL_ERROR) # Define minimum compiler versions @@ -61,26 +61,6 @@ elseif(CMAKE_BUILD_TYPE STREQUAL "Release_O3") endif() message("-- Build type is set to ${CMAKE_BUILD_TYPE}") -# Set certain policies to NEW -foreach(p - CMP0003 # CMake 2.6.0 - CMP0012 # CMake 2.8.0 - CMP0022 # CMake 2.8.12 - CMP0025 # CMake 3.0 - CMP0042 # CMake 3.0 - CMP0048 # CMake 3.0 - CMP0051 # CMake 3.1 - CMP0054 # CMake 3.1 - CMP0060 # CMake 3.16.2 - CMP0063 # CMake 3.3.2 - CMP0068 # CMake 3.9.1 - CMP0074 # CMake 3.12 - ) - if(POLICY ${p}) - cmake_policy(SET ${p} NEW) - endif() -endforeach() - # Set the project name, enabling C, C++ and Fortran support project(gambit C CXX Fortran) @@ -337,11 +317,7 @@ endif() # Fix Boost < 1.55 for Clang if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") - if(${CMAKE_VERSION} VERSION_LESS 3.12.0) - add_definitions(-DBOOST_PP_VARIADICS=1) - else() - add_compile_definitions(BOOST_PP_VARIADICS=1) - endif() + add_compile_definitions(BOOST_PP_VARIADICS=1) endif() # Check for Eigen @@ -508,22 +484,14 @@ option(SUPPRESS_LIBRARY_WARNINGS "Suppress common compiler warnings due to exter string(FIND ${CMAKE_CXX_FLAGS} "-rdynamic" FOUND_RDYNAMIC_CXX) string(FIND ${CMAKE_CXX_FLAGS} "--export-dynamic" FOUND_EXPORT_DYNAMIC_CXX) if(${FOUND_RDYNAMIC_CXX} EQUAL -1 AND ${FOUND_EXPORT_DYNAMIC_CXX} EQUAL -1) - if(${CMAKE_MAJOR_VERSION} MATCHES "2") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") - else() - set(CMAKE_CXX_VISIBILITY_PRESET hidden) - set(CMAKE_VISIBILITY_INLINES_HIDDEN TRUE) - endif() + set(CMAKE_CXX_VISIBILITY_PRESET hidden) + set(CMAKE_VISIBILITY_INLINES_HIDDEN TRUE) endif() string(FIND ${CMAKE_Fortran_FLAGS} "-rdynamic" FOUND_RDYNAMIC_FORTRAN) string(FIND ${CMAKE_Fortran_FLAGS} "--export-dynamic" FOUND_EXPORT_DYNAMIC_FORTRAN) if(${FOUND_RDYNAMIC_FORTRAN} EQUAL -1 AND ${FOUND_EXPORT_DYNAMIC_FORTRAN} EQUAL -1) - if(${CMAKE_MAJOR_VERSION} MATCHES "2") - set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fvisibility=hidden") - else() - set(CMAKE_Fortran_VISIBILITY_PRESET hidden) - endif() + set(CMAKE_Fortran_VISIBILITY_PRESET hidden) endif() # Forbid the use of variable-length array and other non-standard C++ syntax diff --git a/ScannerBit/python/cmake/boost_python_install.cmake b/ScannerBit/python/cmake/boost_python_install.cmake index cb5a69ce95..96fd818750 100644 --- a/ScannerBit/python/cmake/boost_python_install.cmake +++ b/ScannerBit/python/cmake/boost_python_install.cmake @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.12 FATAL_ERROR) +CMAKE_MINIMUM_REQUIRED(VERSION 3.16.3 FATAL_ERROR) find_package(Python3 REQUIRED COMPONENTS Interpreter Development) FIND_PACKAGE(NumPy) diff --git a/cmake/utilities.cmake b/cmake/utilities.cmake index b02f22719a..68c960efce 100644 --- a/cmake/utilities.cmake +++ b/cmake/utilities.cmake @@ -187,11 +187,7 @@ endfunction() # Function to make symbols visible for a code component function(make_symbols_visible lib) - if(${CMAKE_MAJOR_VERSION} MATCHES "2") - set_target_properties(${lib} PROPERTIES COMPILE_OPTIONS "-fvisibility=default") - else() - set_target_properties(${lib} PROPERTIES CXX_VISIBILITY_PRESET default) - endif() + set_target_properties(${lib} PROPERTIES CXX_VISIBILITY_PRESET default) endfunction() # Function to reset the install_name of a library compiled in an external project on OSX @@ -218,15 +214,9 @@ function(add_gambit_library libraryname) add_dependencies(${libraryname} module_harvest) add_dependencies(${libraryname} yaml-cpp) - if(${CMAKE_VERSION} VERSION_GREATER 2.8.10) - foreach (dir ${GAMBIT_INCDIRS}) - target_include_directories(${libraryname} PUBLIC ${dir}) - endforeach() - else() - foreach (dir ${GAMBIT_INCDIRS}) - include_directories(${dir}) - endforeach() - endif() + foreach (dir ${GAMBIT_INCDIRS}) + target_include_directories(${libraryname} PUBLIC ${dir}) + endforeach() if(${ARG_OPTION} STREQUAL SHARED AND APPLE) set_property(TARGET ${libraryname} PROPERTY SUFFIX .so) @@ -318,16 +308,10 @@ function(add_gambit_executable executablename LIBRARIES) ENABLE_EXPORTS TRUE ) - if(${CMAKE_VERSION} VERSION_GREATER 2.8.10) - foreach (dir ${GAMBIT_INCDIRS}) - target_include_directories(${executablename} PUBLIC ${dir}) - endforeach() - else() - foreach (dir ${GAMBIT_INCDIRS}) - include_directories(${dir}) - endforeach() - endif() - + foreach (dir ${GAMBIT_INCDIRS}) + target_include_directories(${executablename} PUBLIC ${dir}) + endforeach() + if(MPI_CXX_FOUND) set(LIBRARIES ${LIBRARIES} ${MPI_CXX_LIBRARIES}) if(MPI_CXX_LINK_FLAGS) diff --git a/gum/CMakeLists.txt b/gum/CMakeLists.txt index 79e8c82850..1cc1687d05 100644 --- a/gum/CMakeLists.txt +++ b/gum/CMakeLists.txt @@ -20,7 +20,7 @@ # # ************************************** -cmake_minimum_required(VERSION 3.12 FATAL_ERROR) +cmake_minimum_required(VERSION 3.16.3 FATAL_ERROR) project(GUM) message(" Building GUM in ${CMAKE_CURRENT_SOURCE_DIR}") include(ExternalProject) @@ -42,13 +42,6 @@ else() set(dashi "-i") endif() -# Set a consistent MACOSX_RPATH default across all CMake versions. -# When CMake 2.8.12 is required, change this default to 1. -# When CMake 3.0.0 is required, remove this block (see CMP0042). -if(NOT DEFINED CMAKE_MACOSX_RPATH) - set(CMAKE_MACOSX_RPATH 0) -endif() - # Check for Mathematica include(../cmake/FindMathematica.cmake) if(Mathematica_FOUND)