Allow overriding default CXX_STANDARD

to ease using newer C++ features in further
projects without setting the standard manually
for each target
feature/exec_app
Martchus 6 years ago
parent 6115933756
commit cb3b50c28c
  1. 2
      cmake/modules/AppTarget.cmake
  2. 5
      cmake/modules/BasicConfig.cmake
  3. 4
      cmake/modules/LibraryTarget.cmake
  4. 2
      cmake/modules/TestTarget.cmake

@ -36,7 +36,7 @@ target_compile_definitions(${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}
PRIVATE "${META_PRIVATE_SHARED_LIB_COMPILE_DEFINITIONS}"
)
set_target_properties(${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX} PROPERTIES
CXX_STANDARD 11
CXX_STANDARD "${META_CXX_STANDARD}"
LINK_SEARCH_START_STATIC ${STATIC_LINKAGE}
LINK_SEARCH_END_STATIC ${STATIC_LINKAGE}
)

@ -17,6 +17,11 @@ if(NOT META_GENERIC_NAME)
set(META_GENERIC_NAME "${META_APP_NAME}")
endif()
# set default CXX_STANDARD for all library, application and test targets to 11
if(NOT META_CXX_STANDARD)
set(META_CXX_STANDARD 11)
endif()
# provide variables for other projects built as part of the same subdirs project
# to access files from this project
get_directory_property(HAS_PARENT PARENT_DIRECTORY)

@ -100,7 +100,7 @@ if(BUILD_SHARED_LIBS)
set_target_properties(${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX} PROPERTIES
VERSION "${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH}"
SOVERSION "${META_SOVERSION}"
CXX_STANDARD 11
CXX_STANDARD "${META_CXX_STANDARD}"
LINK_SEARCH_START_STATIC ${STATIC_LINKAGE}
LINK_SEARCH_END_STATIC ${STATIC_LINKAGE}
)
@ -122,7 +122,7 @@ if(BUILD_STATIC_LIBS)
VERSION "${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH}"
SOVERSION "${META_SOVERSION}"
OUTPUT_NAME "${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}"
CXX_STANDARD 11
CXX_STANDARD "${META_CXX_STANDARD}"
)
foreach(DEPENDENCY ${${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_static_LIB_DEPENDS})
if(NOT ${DEPENDENCY} IN_LIST META_PUBLIC_STATIC_LIB_DEPENDS)

@ -55,7 +55,7 @@ if(CPP_UNIT_LIB)
PRIVATE "${META_PRIVATE_SHARED_LIB_COMPILE_DEFINITIONS}"
)
set_target_properties(${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_tests PROPERTIES
CXX_STANDARD 11
CXX_STANDARD "${META_CXX_STANDARD}"
LINK_SEARCH_START_STATIC ${STATIC_LINKAGE}
LINK_SEARCH_END_STATIC ${STATIC_LINKAGE}
)

Loading…
Cancel
Save