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)
|
||||
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")
|
||||
target_compile_options(rw_interface
|
||||
INTERFACE
|
||||
@ -189,25 +184,36 @@ endforeach()
|
||||
|
||||
function(openrw_target_apply_options)
|
||||
set(IWYU_MAPPING "${PROJECT_SOURCE_DIR}/openrw_iwyu.imp")
|
||||
cmake_parse_arguments("ORW" "INSTALL;INSTALL_PDB;COVERAGE" "TARGET" "COVERAGE_EXCEPT" ${ARGN})
|
||||
if(CHECK_IWYU)
|
||||
iwyu_check(TARGET "${ORW_TARGET}"
|
||||
EXTRA_OPTS
|
||||
"--mapping_file=${IWYU_MAPPING}"
|
||||
)
|
||||
endif()
|
||||
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(CHECK_CLANGTIDY)
|
||||
clang_tidy_check_target(
|
||||
TARGET "${ORW_TARGET}"
|
||||
FORMAT_STYLE "file"
|
||||
FIX "${CHECK_CLANGTIDY_FIX}"
|
||||
CHECK_ALL
|
||||
)
|
||||
if(ORW_CORE)
|
||||
if(CHECK_IWYU)
|
||||
iwyu_check(TARGET "${ORW_TARGET}"
|
||||
EXTRA_OPTS
|
||||
"--mapping_file=${IWYU_MAPPING}"
|
||||
)
|
||||
endif()
|
||||
|
||||
set_target_properties("${ORW_TARGET}"
|
||||
PROPERTIES
|
||||
CXX_EXTENSIONS OFF
|
||||
CXX_STANDARD 17
|
||||
C_EXTENSIONS OFF
|
||||
C_STANDARD 11
|
||||
)
|
||||
|
||||
if(CHECK_CLANGTIDY)
|
||||
clang_tidy_check_target(
|
||||
TARGET "${ORW_TARGET}"
|
||||
FORMAT_STYLE "file"
|
||||
FIX "${CHECK_CLANGTIDY_FIX}"
|
||||
CHECK_ALL
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
|
6
external/microprofile/CMakeLists.txt
vendored
6
external/microprofile/CMakeLists.txt
vendored
@ -25,4 +25,10 @@ openrw_target_apply_options(
|
||||
TARGET microprofile
|
||||
)
|
||||
|
||||
set_target_properties(microprofile
|
||||
PROPERTIES
|
||||
CXX_EXTENSIONS OFF
|
||||
CXX_STANDARD 11
|
||||
)
|
||||
|
||||
add_library(microprofile::microprofile ALIAS microprofile)
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
add_library(rwcore
|
||||
# GL stuff is only here temporarily, hoping to move it back to rwengine
|
||||
gl/gl_core_3_3.c
|
||||
@ -67,6 +66,7 @@ target_link_libraries(rwcore
|
||||
)
|
||||
|
||||
openrw_target_apply_options(TARGET rwcore
|
||||
CORE
|
||||
COVERAGE
|
||||
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
|
||||
CORE
|
||||
COVERAGE
|
||||
)
|
||||
|
||||
|
@ -46,6 +46,7 @@ add_library(librwgame STATIC
|
||||
|
||||
openrw_target_apply_options(
|
||||
TARGET librwgame
|
||||
CORE
|
||||
COVERAGE
|
||||
)
|
||||
|
||||
@ -78,6 +79,7 @@ target_link_libraries(rwgame
|
||||
|
||||
openrw_target_apply_options(
|
||||
TARGET rwgame
|
||||
CORE
|
||||
COVERAGE
|
||||
INSTALL INSTALL_PDB
|
||||
)
|
||||
|
@ -13,6 +13,7 @@ target_link_libraries(rwfontmap
|
||||
|
||||
openrw_target_apply_options(
|
||||
TARGET rwfontmap
|
||||
CORE
|
||||
COVERAGE
|
||||
INSTALL INSTALL_PDB
|
||||
)
|
||||
|
@ -56,6 +56,7 @@ target_link_libraries(rwviewer
|
||||
|
||||
openrw_target_apply_options(
|
||||
TARGET rwviewer
|
||||
CORE
|
||||
COVERAGE
|
||||
INSTALL INSTALL_PDB
|
||||
)
|
||||
|
@ -72,6 +72,7 @@ target_link_libraries(rwtests
|
||||
|
||||
openrw_target_apply_options(
|
||||
TARGET rwtests
|
||||
CORE
|
||||
COVERAGE
|
||||
INSTALL INSTALL_PDB
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user