Commit bd6b72c6 authored by Martin Heistermann's avatar Martin Heistermann

cmake: do not set cxx standard on indidual projects, to avoid mixing versions

parent b5d2a0bb
Pipeline #12317 passed with stage
in 5 minutes and 8 seconds
......@@ -21,8 +21,6 @@ set(OVM_ENABLE_UNITTESTS ${OVM_STANDALONE_BUILD} CACHE BOOL "Build OpenVolumeMes
set(OVM_ENABLE_EXAMPLES ${OVM_STANDALONE_BUILD} CACHE BOOL "Build OpenVolumeMesh examples")
set(OVM_BUILD_DOCUMENTATION ${OVM_STANDALONE_BUILD} CACHE BOOL "Build OpenVolumeMesh documentation")
set(OVM_CXX_STANDARD 11 CACHE STRING "C++ standard version to use")
set_property(CACHE OVM_CXX_STANDARD PROPERTY STRINGS 11 14 17 20)
if (OVM_STANDALONE_BUILD)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Build/bin")
......@@ -41,6 +39,11 @@ if (OVM_STANDALONE_BUILD)
add_definitions(-D_GLIBCXX_DEBUG=1)
add_definitions(-D_GLIBCXX_DEBUG_PEDANTIC=1)
endif()
set(OVM_CXX_STANDARD 11 CACHE STRING "C++ standard version to use")
set_property(CACHE OVM_CXX_STANDARD PROPERTY STRINGS 11 14 17 20)
set(CMAKE_CXX_VERSION ${OVM_CXX_STANDARD})
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
else()
# OVM_TARGET_PREFIX is prepended to targets with generic names,
# i.e., "doc", "unittests"
......
......@@ -69,12 +69,9 @@ generate_export_header(OpenVolumeMesh
set_target_properties (OpenVolumeMesh PROPERTIES
VERSION ${OpenVolumeMesh_VERSION_MAJOR}.${OpenVolumeMesh_VERSION_MINOR}
SOVERSION ${OpenVolumeMesh_VERSION_MAJOR}.${OpenVolumeMesh_VERSION_MINOR}
CXX_STANDARD ${OVM_CXX_STANDARD}
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
POSITION_INDEPENDENT_CODE ON
# TODO: turn this on once we have OVM_EXPORT macros in all required places:
#CXX_VISIBILITY_PRESET hidden
#CXX_VISIBILITY_PRESET hidden
)
......
......@@ -2,11 +2,6 @@ find_package(Boost 1.43.0)
if(Boost_FOUND)
add_executable(file_converter ovm_converter.cc)
set_target_properties (file_converter PROPERTIES
CXX_STANDARD ${OVM_CXX_STANDARD}
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)
target_link_libraries(file_converter OpenVolumeMesh::OpenVolumeMesh Boost::boost)
else()
......
......@@ -5,5 +5,3 @@
#define OPENVOLUMEMESH_VERSION_MINOR @OpenVolumeMesh_VERSION_MINOR@
#define OPENVOLUMEMESH_VERSION_PATCH @OpenVolumeMesh_VERSION_PATCH@
#define OPENVOLUMEMESH_CXX_VERSION @OVM_CXX_STANDARD@
#include "OpenVolumeMesh/Config/Version.hh"
// C++ version at OVM build time,
// to be used for things that change ABI
#if OPENVOLUMEMESH_CXX_VERSION >= 17
#define OVM_BUILD_CXX_17 1
#else
#define OVM_BUILD_CXX_17 0
#endif
// C++ version when compiling (e.g. client code),
// be careful not to change ABI depending on these defines.
......
......@@ -37,9 +37,6 @@ if(GTEST_FOUND)
set_target_properties(${TARGET_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Unittests
CXX_STANDARD ${OVM_CXX_STANDARD}
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)
#[[=
......
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