3
0
mirror of https://github.com/triqs/dft_tools synced 2024-07-17 08:30:35 +02:00

[cmake] rename project_warnings to project specific target, to not export it

This commit is contained in:
Nils Wentzell 2020-04-29 15:31:36 -04:00
parent 136a39dc42
commit 6d4289e024
3 changed files with 16 additions and 19 deletions

View File

@ -78,23 +78,20 @@ add_compile_options(
) )
# Create an Interface target for compiler warnings # Create an Interface target for compiler warnings
if(NOT TARGET project_warnings) add_library(app4triqs_warnings INTERFACE)
add_library(project_warnings INTERFACE) target_compile_options(app4triqs_warnings
target_compile_options(project_warnings INTERFACE
INTERFACE -Wall
-Wall -Wextra
-Wextra -Wpedantic
-Wpedantic -Wno-sign-compare
-Wno-sign-compare $<$<CXX_COMPILER_ID:GNU>:-Wshadow=local>
$<$<CXX_COMPILER_ID:GNU>:-Wshadow=local> $<$<CXX_COMPILER_ID:GNU>:-Wno-attributes>
$<$<CXX_COMPILER_ID:GNU>:-Wno-attributes> $<$<CXX_COMPILER_ID:Clang>:-Wshadow>
$<$<CXX_COMPILER_ID:Clang>:-Wshadow> $<$<CXX_COMPILER_ID:Clang>:-Wno-gcc-compat>
$<$<CXX_COMPILER_ID:Clang>:-Wno-gcc-compat> $<$<CXX_COMPILER_ID:AppleClang>:-Wshadow>
$<$<CXX_COMPILER_ID:AppleClang>:-Wshadow> $<$<CXX_COMPILER_ID:AppleClang>:-Wno-gcc-compat>
$<$<CXX_COMPILER_ID:AppleClang>:-Wno-gcc-compat> )
)
endif()
install(TARGETS project_warnings EXPORT app4triqs-targets)
# ############# # #############
# Build Project # Build Project

View File

@ -2,7 +2,7 @@ file(GLOB_RECURSE sources *.cpp)
add_library(app4triqs_c ${sources}) add_library(app4triqs_c ${sources})
# Link against triqs and enable warnings # Link against triqs and enable warnings
target_link_libraries(app4triqs_c PUBLIC triqs PRIVATE project_warnings) target_link_libraries(app4triqs_c PUBLIC triqs PRIVATE $<BUILD_INTERFACE:app4triqs_warnings>)
# Configure target and compilation # Configure target and compilation
target_compile_options(app4triqs_c PUBLIC -fPIC) target_compile_options(app4triqs_c PUBLIC -fPIC)

View File

@ -11,7 +11,7 @@ foreach(test ${all_tests})
get_filename_component(test_name ${test} NAME_WE) get_filename_component(test_name ${test} NAME_WE)
get_filename_component(test_dir ${test} DIRECTORY) get_filename_component(test_dir ${test} DIRECTORY)
add_executable(${test_name} ${test}) 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}) 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}) add_test(NAME ${test_name} COMMAND ${test_name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir})
# Run clang-tidy if found # Run clang-tidy if found