diff --git a/CMakeLists.txt b/CMakeLists.txt index 0920029c..ce38bdbf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,23 +78,20 @@ add_compile_options( ) # Create an Interface target for compiler warnings -if(NOT TARGET project_warnings) - add_library(project_warnings INTERFACE) - target_compile_options(project_warnings - INTERFACE - -Wall - -Wextra - -Wpedantic - -Wno-sign-compare - $<$:-Wshadow=local> - $<$:-Wno-attributes> - $<$:-Wshadow> - $<$:-Wno-gcc-compat> - $<$:-Wshadow> - $<$:-Wno-gcc-compat> - ) -endif() -install(TARGETS project_warnings EXPORT app4triqs-targets) +add_library(app4triqs_warnings INTERFACE) +target_compile_options(app4triqs_warnings + INTERFACE + -Wall + -Wextra + -Wpedantic + -Wno-sign-compare + $<$:-Wshadow=local> + $<$:-Wno-attributes> + $<$:-Wshadow> + $<$:-Wno-gcc-compat> + $<$:-Wshadow> + $<$:-Wno-gcc-compat> +) # ############# # Build Project diff --git a/c++/app4triqs/CMakeLists.txt b/c++/app4triqs/CMakeLists.txt index d90e2db0..480f157a 100644 --- a/c++/app4triqs/CMakeLists.txt +++ b/c++/app4triqs/CMakeLists.txt @@ -2,7 +2,7 @@ file(GLOB_RECURSE sources *.cpp) add_library(app4triqs_c ${sources}) # Link against triqs and enable warnings -target_link_libraries(app4triqs_c PUBLIC triqs PRIVATE project_warnings) +target_link_libraries(app4triqs_c PUBLIC triqs PRIVATE $) # Configure target and compilation target_compile_options(app4triqs_c PUBLIC -fPIC) diff --git a/test/c++/CMakeLists.txt b/test/c++/CMakeLists.txt index a8855a5f..e8aacaf2 100644 --- a/test/c++/CMakeLists.txt +++ b/test/c++/CMakeLists.txt @@ -11,7 +11,7 @@ foreach(test ${all_tests}) get_filename_component(test_name ${test} NAME_WE) get_filename_component(test_dir ${test} DIRECTORY) add_executable(${test_name} ${test}) - target_link_libraries(${test_name} app4triqs_c gtest_main project_warnings) + target_link_libraries(${test_name} app4triqs_c gtest_main app4triqs_warnings) set_property(TARGET ${test_name} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir}) add_test(NAME ${test_name} COMMAND ${test_name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir}) # Run clang-tidy if found