Commit 0f4a2a26 by Maarten L. Hekkelman

dependencies

check compiler version
parent 6adb5634
...@@ -47,6 +47,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) ...@@ -47,6 +47,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Filesystem REQUIRED) find_package(Filesystem REQUIRED)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# https://stackoverflow.com/questions/63902528/program-crashes-when-filesystempath-is-destroyed
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 8.4.0) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 8.4.0)
message(WARNING "Your gnu compiler is perhaps too old, please use a more recent one if you get a segmentation in the build process when running symop-map-generator") message(WARNING "Your gnu compiler is perhaps too old, please use a more recent one if you get a segmentation in the build process when running symop-map-generator")
endif() endif()
......
@PACKAGE_INIT@ @PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(Boost 1.70.0 REQUIRED COMPONENTS system iostreams regex program_options)
INCLUDE("${CMAKE_CURRENT_LIST_DIR}/cifppTargets.cmake") INCLUDE("${CMAKE_CURRENT_LIST_DIR}/cifppTargets.cmake")
set_and_check(CIFPP_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") set_and_check(CIFPP_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
......
...@@ -27,12 +27,17 @@ int main() { ...@@ -27,12 +27,17 @@ int main() {
} }
]]) ]])
# Check a simple filesystem program without any linker flags if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 8.4.0)
check_cxx_source_compiles("${code}" CXX_FILESYSTEM_NO_LINK_NEEDED) # >> https://stackoverflow.com/questions/63902528/program-crashes-when-filesystempath-is-destroyed
set(CXX_FILESYSTEM_NO_LINK_NEEDED 0)
set(_found ${CXX_FILESYSTEM_NO_LINK_NEEDED}) else()
# Check a simple filesystem program without any linker flags
check_cxx_source_compiles("${code}" CXX_FILESYSTEM_NO_LINK_NEEDED)
endif()
if(NOT CXX_FILESYSTEM_NO_LINK_NEEDED) if(CXX_FILESYSTEM_NO_LINK_NEEDED)
set(_found 1)
else()
set(prev_libraries ${CMAKE_REQUIRED_LIBRARIES}) set(prev_libraries ${CMAKE_REQUIRED_LIBRARIES})
# Add the libstdc++ flag # Add the libstdc++ flag
set(CMAKE_REQUIRED_LIBRARIES ${prev_libraries} -lstdc++fs) set(CMAKE_REQUIRED_LIBRARIES ${prev_libraries} -lstdc++fs)
...@@ -51,7 +56,7 @@ if(_found) ...@@ -51,7 +56,7 @@ if(_found)
set_property(TARGET std::filesystem APPEND PROPERTY INTERFACE_COMPILE_FEATURES cxx_std_17) set_property(TARGET std::filesystem APPEND PROPERTY INTERFACE_COMPILE_FEATURES cxx_std_17)
if(CXX_FILESYSTEM_NO_LINK_NEEDED) if(CXX_FILESYSTEM_NO_LINK_NEEDED)
# Nothing to add... # Nothing to add...
elseif(CXX_FILESYSTEM_STDCPPFS_NEEDED) elseif(CXX_FILESYSTEM_STDCPPFS_NEEDED)
set_property(TARGET std::filesystem APPEND PROPERTY INTERFACE_LINK_LIBRARIES -lstdc++fs) set_property(TARGET std::filesystem APPEND PROPERTY INTERFACE_LINK_LIBRARIES -lstdc++fs)
elseif(CXX_FILESYSTEM_CPPFS_NEEDED) elseif(CXX_FILESYSTEM_CPPFS_NEEDED)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment