Enabled C++11 in CMake for examples and tests only

This commit is contained in:
MaxXSoft 2020-12-11 09:24:32 +08:00 committed by Serge Lamikhov-Center
parent c05cd56dc8
commit ec41276e48

View File

@ -26,9 +26,6 @@ configure_file(${version_header} ${CMAKE_CURRENT_BINARY_DIR}/elfio_version.hpp.c
project(elfio VERSION ${version} LANGUAGES C CXX)
# Enable C++11
set(CMAKE_CXX_STANDARD 11)
include(GNUInstallDirs)
# Create a header only CMake target for elfio
@ -41,6 +38,11 @@ target_include_directories(
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
# Enable C++11 for examples and tests
if (ELFIO_BUILD_EXAMPLES OR ELFIO_BUILD_TESTS)
set(CMAKE_CXX_STANDARD 11)
endif()
if (ELFIO_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()