Skip to content

Commit

Permalink
Use target_compile_features when using CMake 3.8+ to also have the c+…
Browse files Browse the repository at this point in the history
…+ standard in the public interface of the target
  • Loading branch information
texus committed Aug 4, 2019
1 parent 2cd2871 commit 27c9251
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions cmake/Macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,20 @@ function(tgui_set_global_compile_flags target)
-Wdouble-promotion
-Wformat=2)

set_target_properties(${target} PROPERTIES CXX_STANDARD_REQUIRED ON)
set_target_properties(${target} PROPERTIES CXX_EXTENSIONS OFF)
if(TGUI_USE_CPP17)
set_target_properties(${target} PROPERTIES CXX_STANDARD 17)
else()
set_target_properties(${target} PROPERTIES CXX_STANDARD 14)
if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
set_target_properties(${target} PROPERTIES CXX_STANDARD_REQUIRED ON)
if(TGUI_USE_CPP17)
set_target_properties(${target} PROPERTIES CXX_STANDARD 17)
else()
set_target_properties(${target} PROPERTIES CXX_STANDARD 14)
endif()
else() # CMake 3.8 or newer
if(TGUI_USE_CPP17)
target_compile_features(${target} PUBLIC cxx_std_17)
else()
target_compile_features(${target} PUBLIC cxx_std_14)
endif()
endif()
endif()
endfunction()
Expand Down

0 comments on commit 27c9251

Please sign in to comment.