Skip to content

Commit

Permalink
Move CMAKE_CXX_EXTENSIONS and CMAKE_CXX_STANDARD_REQUIRED onto each t…
Browse files Browse the repository at this point in the history
…arget
  • Loading branch information
adamkewley committed Jun 18, 2024
1 parent b4e413a commit a5b67e4
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 6 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ if(UNIX AND NOT APPLE)
set(LINUX TRUE)
endif()

set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_EXECUTABLE_SUFFIX ${OSC_EXECUTABLE_SUFFIX}) # note: cannot be set externally

Expand Down
6 changes: 6 additions & 0 deletions apps/hellotriangle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ target_link_libraries(hellotriangle PUBLIC
oscar
)

set_target_properties(hellotriangle PROPERTIES
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
)


# for development on Windows, copy all runtime dlls to the exe directory
# (because Windows doesn't have an RPATH)
#
Expand Down
5 changes: 5 additions & 0 deletions apps/osc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ target_link_options(osc PUBLIC
>
)

set_target_properties(osc PROPERTIES
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
)


# -------------- installation/packaging ------------- #

Expand Down
5 changes: 5 additions & 0 deletions src/OpenSimCreator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -470,3 +470,8 @@ target_compile_options(OpenSimCreator PUBLIC
-Wno-array-bounds
>
)

set_target_properties(OpenSimCreator PROPERTIES
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
)
5 changes: 5 additions & 0 deletions src/OpenSimThirdPartyPlugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ set_target_properties(OpenSimThirdPartyPlugins PROPERTIES
)

target_compile_features(OpenSimThirdPartyPlugins PRIVATE cxx_std_14)

set_target_properties(OpenSimThirdPartyPlugins PROPERTIES
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
)
5 changes: 5 additions & 0 deletions src/oscar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -446,3 +446,8 @@ target_link_libraries(oscar PUBLIC
tomlplusplus::tomlplusplus
lunasvg::lunasvg
)

set_target_properties(oscar PROPERTIES
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
)
5 changes: 5 additions & 0 deletions src/oscar_demos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ target_include_directories(oscar_demos PUBLIC
target_link_libraries(oscar_demos PUBLIC
oscar
)

set_target_properties(oscar_demos PROPERTIES
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
)
5 changes: 5 additions & 0 deletions src/oscar_learnopengl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,8 @@ target_include_directories(oscar_learnopengl PUBLIC
target_link_libraries(oscar_learnopengl PUBLIC
oscar
)

set_target_properties(oscar_learnopengl PROPERTIES
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
)
8 changes: 7 additions & 1 deletion tests/TestOpenSimCreator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ add_executable(TestOpenSimCreator
Documents/ModelWarper/TestFrameWarperFactories.cpp
Documents/ModelWarper/TestModelWarpDocument.cpp
Documents/ModelWarper/TestPointWarperFactories.cpp
Documents/OutputExtractors/TestConstantOutputExtractor.cpp
Documents/Simulation/TestForwardDynamicSimulation.cpp
Documents/Simulation/TestSimulationHelpers.cpp
Graphics/TestOpenSimDecorationGenerator.cpp
Expand All @@ -25,7 +26,7 @@ add_executable(TestOpenSimCreator
Utils/TestShapeFitters.cpp

TestOpenSimCreator.cpp # entrypoint (main)
"Documents/OutputExtractors/TestConstantOutputExtractor.cpp")
)

configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/TestOpenSimCreatorConfig.h.in"
Expand All @@ -49,6 +50,11 @@ target_link_libraries(TestOpenSimCreator PUBLIC
GTest::gtest_main
)

set_target_properties(TestOpenSimCreator PROPERTIES
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
)

# tell CMake (+IDEs) how to find all tests
if(${OSC_DISCOVER_TESTS})
gtest_discover_tests(TestOpenSimCreator)
Expand Down
5 changes: 5 additions & 0 deletions tests/testoscar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ target_link_libraries(testoscar PUBLIC
GTest::gtest_main
)

set_target_properties(testoscar PROPERTIES
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
)

# tell CMake (+IDEs) how to find all tests
if(${OSC_DISCOVER_TESTS})
gtest_discover_tests(testoscar)
Expand Down
10 changes: 8 additions & 2 deletions tests/testoscar_demos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ target_link_libraries(testoscar_demos PUBLIC
GTest::gtest_main
)

# tell CMake (+IDEs) how to find all tests
gtest_discover_tests(testoscar_demos)
set_target_properties(testoscar_demos PROPERTIES
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
)

if(${OSC_DISCOVER_TESTS})
gtest_discover_tests(testoscar_demos)
endif()

# for development on Windows, copy all runtime dlls to the exe directory
# (because Windows doesn't have an RPATH)
Expand Down
6 changes: 5 additions & 1 deletion tests/testoscar_learnopengl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ target_link_libraries(testoscar_learnopengl PUBLIC
GTest::gtest_main
)

# tell CMake (+IDEs) how to find all tests
set_target_properties(testoscar_learnopengl PROPERTIES
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
)

if(${OSC_DISCOVER_TESTS})
gtest_discover_tests(testoscar_learnopengl)
endif()
Expand Down

0 comments on commit a5b67e4

Please sign in to comment.