nameof_module/example/CMakeLists.txt
sha512sum ad4ba073a3
Some checks failed
macos / macos-13 (push) Has been cancelled
macos / macos-14 (push) Has been cancelled
ubuntu / clang-10 (push) Has been cancelled
ubuntu / clang-11 (push) Has been cancelled
ubuntu / clang-12 (push) Has been cancelled
ubuntu / clang-13 (push) Has been cancelled
ubuntu / clang-14 (push) Has been cancelled
ubuntu / clang-15 (push) Has been cancelled
ubuntu / clang-16 (push) Has been cancelled
ubuntu / clang-9 (push) Has been cancelled
ubuntu / gcc-10 (push) Has been cancelled
ubuntu / gcc-11 (push) Has been cancelled
ubuntu / gcc-12 (push) Has been cancelled
ubuntu / gcc-13 (push) Has been cancelled
ubuntu / gcc-14 (push) Has been cancelled
ubuntu / gcc-9 (push) Has been cancelled
windows / Visual Studio 2019 (push) Has been cancelled
windows / Visual Studio 2022 (push) Has been cancelled
Add nameof module support
2024-10-19 23:02:24 +00:00

23 lines
734 B
CMake

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()
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)
if(NAMEOF_MODULE)
make_example(example_module)
endif()