mirror of
https://github.com/triqs/dft_tools
synced 2025-01-03 10:05:49 +01:00
[cmake] rename project_warnings to project specific target, to not export it
This commit is contained in:
parent
136a39dc42
commit
6d4289e024
@ -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
|
||||
$<$<CXX_COMPILER_ID:GNU>:-Wshadow=local>
|
||||
$<$<CXX_COMPILER_ID:GNU>:-Wno-attributes>
|
||||
$<$<CXX_COMPILER_ID:Clang>:-Wshadow>
|
||||
$<$<CXX_COMPILER_ID:Clang>:-Wno-gcc-compat>
|
||||
$<$<CXX_COMPILER_ID:AppleClang>:-Wshadow>
|
||||
$<$<CXX_COMPILER_ID:AppleClang>:-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
|
||||
$<$<CXX_COMPILER_ID:GNU>:-Wshadow=local>
|
||||
$<$<CXX_COMPILER_ID:GNU>:-Wno-attributes>
|
||||
$<$<CXX_COMPILER_ID:Clang>:-Wshadow>
|
||||
$<$<CXX_COMPILER_ID:Clang>:-Wno-gcc-compat>
|
||||
$<$<CXX_COMPILER_ID:AppleClang>:-Wshadow>
|
||||
$<$<CXX_COMPILER_ID:AppleClang>:-Wno-gcc-compat>
|
||||
)
|
||||
|
||||
# #############
|
||||
# Build Project
|
||||
|
@ -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 $<BUILD_INTERFACE:app4triqs_warnings>)
|
||||
|
||||
# Configure target and compilation
|
||||
target_compile_options(app4triqs_c PUBLIC -fPIC)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user