Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump minimum CMake version to 3.16 #200

Merged
merged 6 commits into from
May 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
CMAKE_MINIMUM_REQUIRED(VERSION 3.16)

PROJECT(REST)

Expand All @@ -19,6 +19,11 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-stdlib=libc++")
endif (CMAKE_SYSTEM_NAME MATCHES "Darwin")

# https://github.com/rest-for-physics/framework/issues/162
if (${CMAKE_VERSION} VERSION_LESS "3.21")
cmake_policy(SET CMP0082 OLD)
endif ()

# Install path
if (NOT DEFINED INSTALL_PREFIX)
if (DEFINED ENV{REST_PATH})
Expand Down
21 changes: 6 additions & 15 deletions cmake/Testing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ if (TEST)
add_compile_definitions(REST_TESTING_ENABLED)
endif ()

macro(ADD_TEST)
if (TEST)
message(STATUS "Adding tests at ${CMAKE_CURRENT_SOURCE_DIR}")
add_subdirectory(test)
endif ()
endmacro()

macro(ADD_LIBRARY_TEST)
if (TEST)
message(STATUS "Adding tests at ${CMAKE_CURRENT_SOURCE_DIR}")
Expand All @@ -31,13 +24,9 @@ macro(ADD_LIBRARY_TEST)

enable_testing()

add_executable(${TESTING_EXECUTABLE})

FILE(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/test/src/*.cxx)
target_sources(
${TESTING_EXECUTABLE} PUBLIC
${SOURCES}
)

add_executable(${TESTING_EXECUTABLE} ${SOURCES})

target_link_libraries(
${TESTING_EXECUTABLE} PUBLIC
Expand All @@ -49,7 +38,9 @@ macro(ADD_LIBRARY_TEST)

include(GoogleTest)

gtest_discover_tests(${TESTING_EXECUTABLE})

gtest_add_tests(
TARGET ${TESTING_EXECUTABLE}
SOURCES ${SOURCES}
)
endif ()
endmacro()
2 changes: 1 addition & 1 deletion cmake/thisREST.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ string(REGEX REPLACE "\n$" "" GEANT4_PATH "${GEANT4_PATH}")
set(thisGeant4 "${GEANT4_PATH}/bin/geant4.sh")

if (${REST_G4} MATCHES "ON")
set(loadG4 "\# if geant4.sh script is found we load the same Geant4 version as used in compilation\n if [[ -f \"${thisGeant4}\" && ${thisGeant4} != /usr/* ]]; then
set(loadG4 "\# if geant4.sh script is found we load the same Geant4 version as used in compilation\n if [[ -f \\\"${thisGeant4}\\\" && ${thisGeant4} != /usr/* ]]; then
source ${thisGeant4}\n fi\n")
else ()
set(loadG4 "")
Expand Down