2019-08-24 15:31:42 +00:00
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
|
|
|
|
if((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
|
|
|
|
set(OPTIONS -Wall -Wextra -pedantic-errors -Werror)
|
|
|
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|
|
|
set(OPTIONS /W4 /WX)
|
|
|
|
if(HAS_PERMISSIVE_FLAG)
|
|
|
|
set(OPTIONS ${OPTIONS} /permissive-)
|
|
|
|
endif()
|
|
|
|
endif()
|
2019-07-31 16:09:26 +00:00
|
|
|
|
2020-12-29 18:45:54 +00:00
|
|
|
function(make_example target)
|
|
|
|
add_executable(${target} ${target}.cpp)
|
|
|
|
set_target_properties(${target} PROPERTIES CXX_EXTENSIONS OFF)
|
|
|
|
target_compile_options(${target} PRIVATE ${OPTIONS})
|
|
|
|
target_link_libraries(${target} PRIVATE ${CMAKE_PROJECT_NAME})
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
make_example(example)
|
|
|
|
make_example(example_custom_name)
|
2024-10-19 23:02:24 +00:00
|
|
|
if(NAMEOF_MODULE)
|
|
|
|
make_example(example_module)
|
|
|
|
endif()
|