From a26c325d385b8c3eaa309fffeeb0add8a3c6950b Mon Sep 17 00:00:00 2001 From: Jonas Schuhmacher Date: Thu, 11 Jul 2024 17:35:25 +0200 Subject: [PATCH] update CMakeLists.txt for macOS This is achieved by updating the CMake set-up: - add find_package(XercesC ...) (can be installed via brew) - link the target, as specified by FindXercesC.cmake - decrease the C++ standard to 14 (This is required, as libxsd uses std::auto_ptr which was removed in C++17. Hence, stricter compilers (e.g. Apple Clang) refuse to compile) --- CMakeLists.txt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 08c388888..562b2b3be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,12 @@ cmake_minimum_required(VERSION 3.10) # define project name, version -project(PSEMolDyn VERSION 0.0.1) +project(PSEMolDyn VERSION 0.0.1 LANGUAGES CXX) + +# Finds the xerces-c library on your system +# on linux: apt install libxerces-c-dev +# on macOS: brew install xerces-c +find_package(XercesC REQUIRED) # let ccmake and cmake-gui offer the default build type options set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug;Release;RelWithDebInfo;MinSizeRel") @@ -22,10 +27,12 @@ file(GLOB_RECURSE MY_SRC # create make target add_executable(MolSim ${MY_SRC}) -# set cxx standard. You may raise this if you want. +# You may raise the C++ standard if you want +# Note, the bundled libxsd uses std::auto_ptr which was deprecated in C++11 and removed in C++17 +# Hence, some compilers (e.g. Apple Clang) refuse to compile with C++17, but e.g. not GNU GCC target_compile_features(MolSim PRIVATE - cxx_std_17 + cxx_std_14 ) target_include_directories(MolSim @@ -38,7 +45,7 @@ target_include_directories(MolSim target_link_libraries(MolSim # stuff that is used in headers and source files PUBLIC - xerces-c + XercesC::XercesC ) # activate all compiler warnings. Clean up your code :P