diff --git a/CMakeLists.txt b/CMakeLists.txt index 96322637..3a3939b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,9 @@ -cmake_minimum_required(VERSION 3.13) +cmake_minimum_required(VERSION 3.18) set (EKAT_CMAKE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake CACHE INTERNAL "") # Do not ignore env vars in find_package() calls -if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12.0") - cmake_policy (SET CMP0074 NEW) -endif(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12.0") +cmake_policy (SET CMP0074 NEW) # Add our own cmake goodies to cmake module search path list(APPEND CMAKE_MODULE_PATH @@ -29,9 +27,9 @@ endif() include(EkatUtils) IsDebugBuild(EKAT_IS_DEBUG_BUILD) -set (EKAT_VERSION_MAJOR 1) +set (EKAT_VERSION_MAJOR 2) set (EKAT_VERSION_MINOR 0) -set (EKAT_VERSION_PATCH 1) +set (EKAT_VERSION_PATCH 0) message(STATUS "EKAT version: ${EKAT_VERSION_MAJOR}.${EKAT_VERSION_MINOR}.${EKAT_VERSION_PATCH}") diff --git a/cmake/EkatCreateUnitTest.cmake b/cmake/EkatCreateUnitTest.cmake index 047adc2f..96cfe558 100644 --- a/cmake/EkatCreateUnitTest.cmake +++ b/cmake/EkatCreateUnitTest.cmake @@ -57,19 +57,17 @@ function(EkatCreateUnitTestExec exec_name exec_srcs) # Create the executable and set its properties # #-------------------------------------------------# - # Set link directories (must be done BEFORE add_executable is called) - # NOTE: CMake 3.15 adds 'target_link_directories', which is superior (does not pollute other targets). - # We should switch to that as soon as we can assume CMAKE_VERSION >= 3.15. set(target_name ${exec_name}) - if (ecute_LIBS_DIRS) - link_directories("${ecute_LIBS_DIRS}") - endif() add_executable(${target_name} ${exec_srcs}) #---------------------------# # Set all target properties # #---------------------------# + if (ecute_LIBS_DIRS) + target_link_directories(${target_name} PRIVATE "${ecute_LIBS_DIRS}") + endif() + target_link_libraries (${exec_name} PUBLIC Catch2::Catch2) # Include dirs diff --git a/cmake/EkatUtils.cmake b/cmake/EkatUtils.cmake index 46c72351..8ef74a62 100644 --- a/cmake/EkatUtils.cmake +++ b/cmake/EkatUtils.cmake @@ -126,13 +126,8 @@ macro (EkatDisableAllWarning targetName) $<$:$<$:-w> $<$: -w>>) target_compile_options (${targetName} PRIVATE $<$:$<$:-w -fcompare-debug-second> $<$: -w>>) - if (${CMAKE_VERSION} VERSION_LESS "3.14.0") - target_compile_options (${targetName} PRIVATE - $<$:$<$:-w> $<$: -w>>) - else () - target_compile_options (${targetName} PRIVATE - $<$:$<$:-w> $<$: -w>>) - endif() + target_compile_options (${targetName} PRIVATE + $<$:$<$:-w> $<$: -w>>) endmacro (EkatDisableAllWarning) function(separate_cut_arguments prefix options oneValueArgs multiValueArgs return_varname) diff --git a/cmake/tpls/EkatBuildCatch2.cmake b/cmake/tpls/EkatBuildCatch2.cmake index 7c5cf8f6..6bf7e358 100644 --- a/cmake/tpls/EkatBuildCatch2.cmake +++ b/cmake/tpls/EkatBuildCatch2.cmake @@ -16,15 +16,4 @@ FetchContent_Declare(Catch2 BINARY_DIR ${EKAT_BINARY_DIR}/extern/Catch2 ) -# MakeAvailable is better, but we need CMake>=3.14... -if(CMAKE_VERSION VERSION_LESS "3.14") - # Legacy path for CMake 3.11 - 3.13 - FetchContent_GetProperties(Catch2) - if(NOT catch2_POPULATED) - FetchContent_Populate(Catch2) - add_subdirectory(${catch2_SOURCE_DIR} ${catch2_BINARY_DIR}) - endif() -else() - # Modern path for 3.14+ (Silences CMP0169 in 3.30+) - FetchContent_MakeAvailable(Catch2) -endif() +FetchContent_MakeAvailable(Catch2) diff --git a/cmake/tpls/EkatBuildSpdlog.cmake b/cmake/tpls/EkatBuildSpdlog.cmake index 33b08217..0acbed6d 100644 --- a/cmake/tpls/EkatBuildSpdlog.cmake +++ b/cmake/tpls/EkatBuildSpdlog.cmake @@ -15,18 +15,7 @@ FetchContent_Declare(spdlog BINARY_DIR ${EKAT_BINARY_DIR}/extern/spdlog ) -# MakeAvailable is better, but we need CMake>=3.14... -if(CMAKE_VERSION VERSION_LESS "3.14") - # Legacy path for CMake 3.11 - 3.13 - FetchContent_GetProperties(spdlog) - if(NOT spdlog_POPULATED) - FetchContent_Populate(spdlog) - add_subdirectory (${spdlog_SOURCE_DIR} ${spdlog_BINARY_DIR}) - endif() -else() - # Modern path for 3.14+ (Silences CMP0169 in 3.30+) - FetchContent_MakeAvailable(spdlog) -endif() +FetchContent_MakeAvailable(spdlog) if (EKAT_DISABLE_TPL_WARNINGS) include (EkatUtils) diff --git a/cmake/tpls/EkatBuildYamlCpp.cmake b/cmake/tpls/EkatBuildYamlCpp.cmake index eecf197a..3d02d5f3 100644 --- a/cmake/tpls/EkatBuildYamlCpp.cmake +++ b/cmake/tpls/EkatBuildYamlCpp.cmake @@ -14,18 +14,7 @@ FetchContent_Declare(yaml-cpp BINARY_DIR ${EKAT_BINARY_DIR}/extern/yaml-cpp ) -# MakeAvailable is better, but we need CMake>=3.14... -if(CMAKE_VERSION VERSION_LESS "3.14") - # Legacy path for CMake 3.11 - 3.13 - FetchContent_GetProperties(yaml-cpp) - if(NOT yaml-cpp_POPULATED) - FetchContent_Populate(yaml-cpp) - add_subdirectory (${yaml-cpp_SOURCE_DIR} ${yaml-cpp_BINARY_DIR}) - endif() -else() - # Modern path for 3.14+ (Silences CMP0169 in 3.30+) - FetchContent_MakeAvailable(yaml-cpp) -endif() +FetchContent_MakeAvailable(yaml-cpp) if (EKAT_DISABLE_TPL_WARNINGS) include (EkatUtils)