2019-03-21 11:05:37 +00:00
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/include)
|
2018-03-17 04:31:59 +00:00
|
|
|
|
2019-03-12 13:55:56 +00:00
|
|
|
set(OPTIONS "")
|
2018-08-29 11:57:44 +00:00
|
|
|
|
|
|
|
if((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
|
|
|
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
2019-03-12 13:55:56 +00:00
|
|
|
set(OPTIONS -Wall -Wextra -pedantic-errors)
|
2019-03-20 16:41:51 +00:00
|
|
|
set(OPTIONS ${OPTIONS} -std=c++17)
|
2018-08-29 11:57:44 +00:00
|
|
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
2019-03-12 13:55:56 +00:00
|
|
|
set(OPTIONS /W4)
|
2019-03-21 11:05:37 +00:00
|
|
|
check_cxx_compiler_flag(/permissive HAS_PERMISSIVE_FLAG)
|
|
|
|
if(HAS_PERMISSIVE_FLAG)
|
2019-03-12 13:55:56 +00:00
|
|
|
set(OPTIONS ${OPTIONS} /permissive-)
|
2018-08-29 11:57:44 +00:00
|
|
|
endif()
|
2019-03-20 16:41:51 +00:00
|
|
|
set(OPTIONS ${OPTIONS} /std:c++17)
|
2018-08-29 11:57:44 +00:00
|
|
|
endif()
|
2019-03-12 13:55:56 +00:00
|
|
|
|
|
|
|
add_executable(example
|
|
|
|
example.cpp
|
|
|
|
${CMAKE_SOURCE_DIR}/include/nameof.hpp)
|
|
|
|
target_compile_options(example PRIVATE ${OPTIONS})
|