Skip to content
Snippets Groups Projects
Commit b27ae4d7 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

use variables CLANG, GCC, LINUX in CMake code

parent ce4a1c44
No related branches found
No related tags found
1 merge request!515CMake: define and use variables CLANG, GCC, LINUX
Pipeline #51449 failed
......@@ -35,15 +35,15 @@ target_include_directories(${lib}
# g++ versions less than 9.1 need to link against libstdc++fs
# if std::filesystem is used
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
if(GCC
AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.1)
target_link_libraries(${lib} PRIVATE stdc++fs)
endif()
# the same applies to clang versions less than 9.0: they need to link
# against libstdc++fs or libc++fs if std::filesystem is used
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
if(CLANG
AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
if(LINUX)
target_link_libraries(${lib} PRIVATE stdc++fs)
else()
target_link_libraries(${lib} PRIVATE c++fs)
......
......@@ -13,7 +13,7 @@ target_include_directories(${test} PUBLIC
${CMAKE_SOURCE_DIR}/3rdparty/common/gtest/gtest-1.8.0/include
${CMAKE_SOURCE_DIR}/Tests/Unit/utilities)
target_link_libraries(${test} ${BornAgainCore_LIBRARY} gtest)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(GCC)
target_compile_options(${test} PUBLIC "-Wno-deprecated-copy")
endif()
......
......@@ -3,7 +3,7 @@
function(MakeLib name lib tmpdir withPython)
if(withPython)
if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
if((CLANG) OR (GCC))
# suppress warnings from auto-generated code (last updated for Swig 4.0.1)
set_source_files_properties(${AUTO_DIR}/lib${lib}_wrap.cpp
PROPERTIES COMPILE_OPTIONS
......
......@@ -43,7 +43,7 @@ else()
message(FATAL_ERROR "C compiler is not GNU; don't know how to set code coverage flags!")
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(GCC)
string(APPEND CMAKE_CXX_FLAGS " -coverage")
else()
message(FATAL_ERROR "CXX compiler is not GNU; don't know how to set code coverage flags!")
......
......@@ -22,7 +22,7 @@ else()
message(WARNING "C compiler is not GNU; debug optimization has no effect")
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(GCC)
string(APPEND CMAKE_CXX_FLAGS " -Og")
else()
message(WARNING "C compiler is not GNU; debug optimization has no effect")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment