mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-22 02:12:45 +01:00
cmake: only set C and C++ standard for "core targets"
core targets = developed by us
This commit is contained in:
parent
35731f2031
commit
58c0dcd8ce
@ -5,11 +5,6 @@ add_library(rw_checks INTERFACE)
|
|||||||
add_library(openrw::checks ALIAS rw_checks)
|
add_library(openrw::checks ALIAS rw_checks)
|
||||||
target_link_libraries(rw_interface INTERFACE rw_checks)
|
target_link_libraries(rw_interface INTERFACE rw_checks)
|
||||||
|
|
||||||
# target_compile_features(rw_interface INTERFACE cxx_std_14) is not supported by CMake 3.2
|
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||||
target_compile_options(rw_interface
|
target_compile_options(rw_interface
|
||||||
INTERFACE
|
INTERFACE
|
||||||
@ -189,7 +184,13 @@ endforeach()
|
|||||||
|
|
||||||
function(openrw_target_apply_options)
|
function(openrw_target_apply_options)
|
||||||
set(IWYU_MAPPING "${PROJECT_SOURCE_DIR}/openrw_iwyu.imp")
|
set(IWYU_MAPPING "${PROJECT_SOURCE_DIR}/openrw_iwyu.imp")
|
||||||
cmake_parse_arguments("ORW" "INSTALL;INSTALL_PDB;COVERAGE" "TARGET" "COVERAGE_EXCEPT" ${ARGN})
|
cmake_parse_arguments("ORW" "CORE;INSTALL;INSTALL_PDB;COVERAGE" "TARGET" "COVERAGE_EXCEPT" ${ARGN})
|
||||||
|
|
||||||
|
if(TEST_COVERAGE AND ORW_COVERAGE)
|
||||||
|
coverage_add_target("${ORW_TARGET}" EXCEPT ${ORW_COVERAGE_EXCEPT})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ORW_CORE)
|
||||||
if(CHECK_IWYU)
|
if(CHECK_IWYU)
|
||||||
iwyu_check(TARGET "${ORW_TARGET}"
|
iwyu_check(TARGET "${ORW_TARGET}"
|
||||||
EXTRA_OPTS
|
EXTRA_OPTS
|
||||||
@ -197,9 +198,13 @@ function(openrw_target_apply_options)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(TEST_COVERAGE AND ORW_COVERAGE)
|
set_target_properties("${ORW_TARGET}"
|
||||||
coverage_add_target("${ORW_TARGET}" EXCEPT ${ORW_COVERAGE_EXCEPT})
|
PROPERTIES
|
||||||
endif()
|
CXX_EXTENSIONS OFF
|
||||||
|
CXX_STANDARD 17
|
||||||
|
C_EXTENSIONS OFF
|
||||||
|
C_STANDARD 11
|
||||||
|
)
|
||||||
|
|
||||||
if(CHECK_CLANGTIDY)
|
if(CHECK_CLANGTIDY)
|
||||||
clang_tidy_check_target(
|
clang_tidy_check_target(
|
||||||
@ -209,6 +214,7 @@ function(openrw_target_apply_options)
|
|||||||
CHECK_ALL
|
CHECK_ALL
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||||
set_property(
|
set_property(
|
||||||
|
6
external/microprofile/CMakeLists.txt
vendored
6
external/microprofile/CMakeLists.txt
vendored
@ -25,4 +25,10 @@ openrw_target_apply_options(
|
|||||||
TARGET microprofile
|
TARGET microprofile
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set_target_properties(microprofile
|
||||||
|
PROPERTIES
|
||||||
|
CXX_EXTENSIONS OFF
|
||||||
|
CXX_STANDARD 11
|
||||||
|
)
|
||||||
|
|
||||||
add_library(microprofile::microprofile ALIAS microprofile)
|
add_library(microprofile::microprofile ALIAS microprofile)
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
add_library(rwcore
|
add_library(rwcore
|
||||||
# GL stuff is only here temporarily, hoping to move it back to rwengine
|
# GL stuff is only here temporarily, hoping to move it back to rwengine
|
||||||
gl/gl_core_3_3.c
|
gl/gl_core_3_3.c
|
||||||
@ -67,6 +66,7 @@ target_link_libraries(rwcore
|
|||||||
)
|
)
|
||||||
|
|
||||||
openrw_target_apply_options(TARGET rwcore
|
openrw_target_apply_options(TARGET rwcore
|
||||||
|
CORE
|
||||||
COVERAGE
|
COVERAGE
|
||||||
COVERAGE_EXCEPT gl/gl_core_3_3.c gl/gl_core_3_3.h
|
COVERAGE_EXCEPT gl/gl_core_3_3.c gl/gl_core_3_3.h
|
||||||
)
|
)
|
||||||
|
@ -169,6 +169,7 @@ target_include_directories(rwengine
|
|||||||
)
|
)
|
||||||
|
|
||||||
openrw_target_apply_options(TARGET rwengine
|
openrw_target_apply_options(TARGET rwengine
|
||||||
|
CORE
|
||||||
COVERAGE
|
COVERAGE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ add_library(librwgame STATIC
|
|||||||
|
|
||||||
openrw_target_apply_options(
|
openrw_target_apply_options(
|
||||||
TARGET librwgame
|
TARGET librwgame
|
||||||
|
CORE
|
||||||
COVERAGE
|
COVERAGE
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -78,6 +79,7 @@ target_link_libraries(rwgame
|
|||||||
|
|
||||||
openrw_target_apply_options(
|
openrw_target_apply_options(
|
||||||
TARGET rwgame
|
TARGET rwgame
|
||||||
|
CORE
|
||||||
COVERAGE
|
COVERAGE
|
||||||
INSTALL INSTALL_PDB
|
INSTALL INSTALL_PDB
|
||||||
)
|
)
|
||||||
|
@ -13,6 +13,7 @@ target_link_libraries(rwfontmap
|
|||||||
|
|
||||||
openrw_target_apply_options(
|
openrw_target_apply_options(
|
||||||
TARGET rwfontmap
|
TARGET rwfontmap
|
||||||
|
CORE
|
||||||
COVERAGE
|
COVERAGE
|
||||||
INSTALL INSTALL_PDB
|
INSTALL INSTALL_PDB
|
||||||
)
|
)
|
||||||
|
@ -56,6 +56,7 @@ target_link_libraries(rwviewer
|
|||||||
|
|
||||||
openrw_target_apply_options(
|
openrw_target_apply_options(
|
||||||
TARGET rwviewer
|
TARGET rwviewer
|
||||||
|
CORE
|
||||||
COVERAGE
|
COVERAGE
|
||||||
INSTALL INSTALL_PDB
|
INSTALL INSTALL_PDB
|
||||||
)
|
)
|
||||||
|
@ -72,6 +72,7 @@ target_link_libraries(rwtests
|
|||||||
|
|
||||||
openrw_target_apply_options(
|
openrw_target_apply_options(
|
||||||
TARGET rwtests
|
TARGET rwtests
|
||||||
|
CORE
|
||||||
COVERAGE
|
COVERAGE
|
||||||
INSTALL INSTALL_PDB
|
INSTALL INSTALL_PDB
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user