Improve CMake

This commit is contained in:
Jonathan Müller 2018-12-18 17:49:26 +01:00
commit d44571f1c8
5 changed files with 19 additions and 27 deletions

View file

@ -102,16 +102,17 @@ set(libclang_source
libclang/variable_parser.cpp)
add_library(cppast ${detail_header} ${header} ${source} ${libclang_source})
set_target_properties(cppast PROPERTIES CXX_STANDARD 11)
target_include_directories(cppast PUBLIC ../include)
target_compile_features(cppast PUBLIC cxx_std_11)
target_include_directories(cppast PRIVATE ../include SYSTEM INTERFACE ../include)
target_link_libraries(cppast PUBLIC type_safe _cppast_tiny_process _cppast_libclang)
target_compile_definitions(cppast PUBLIC
CPPAST_VERSION_MINOR="${cppast_VERSION_MINOR}"
CPPAST_VERSION_MAJOR="${cppast_VERSION_MAJOR}"
CPPAST_VERSION_STRING="${cppast_VERSION}")
if(CPPAST_ENABLE_ASSERTIONS)
target_compile_definitions(cppast PUBLIC CPPAST_ENABLE_ASSERTIONS)
endif()
if(CPPAST_ENABLE_PRECONDITION_CHECKS)
target_compile_definitions(cppast PUBLIC CPPAST_ENABLE_PRECONDITION_CHECKS)
endif()
target_compile_options(cppast PRIVATE
# clang/GCC warnings
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>>:
-pedantic-errors -Werror -Wall -Wextra -Wconversion -Wsign-conversion>
# MSVC warnings
$<$<CXX_COMPILER_ID:MSVC>:
/WX /W4>)