mirror of
https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git
synced 2025-06-02 01:47:56 +00:00
cmake: Export library to standardize compiler/linker options
Also fixes issue where compiler warnings weren't being applied to Vulkan::LayerSettings closes #106
This commit is contained in:
parent
d3e6eb65dd
commit
4642e14f71
9 changed files with 136 additions and 77 deletions
tests
|
@ -32,4 +32,28 @@ if (NOT TARGET Vulkan::UtilityHeaders)
|
|||
message(FATAL_ERROR "Vulkan::UtilityHeaders target not defined!")
|
||||
endif()
|
||||
|
||||
target_link_libraries(find_package_example PRIVATE Vulkan::LayerSettings Vulkan::UtilityHeaders)
|
||||
target_link_libraries(find_package_example PRIVATE
|
||||
Vulkan::LayerSettings
|
||||
Vulkan::UtilityHeaders
|
||||
)
|
||||
|
||||
# NOTE: Because Vulkan::Headers header files are exposed in the public facing interface
|
||||
# we must expose this library to users.
|
||||
get_target_property(property Vulkan::LayerSettings INTERFACE_LINK_LIBRARIES)
|
||||
if (NOT property MATCHES "Vulkan::Headers")
|
||||
message(FATAL_ERROR "Vulkan::Headers not linked properly!")
|
||||
endif()
|
||||
get_target_property(property Vulkan::UtilityHeaders INTERFACE_LINK_LIBRARIES)
|
||||
if (NOT property MATCHES "Vulkan::Headers")
|
||||
message(FATAL_ERROR "Vulkan::Headers not linked properly!")
|
||||
endif()
|
||||
|
||||
# Prevent regression of https://github.com/KhronosGroup/Vulkan-Utility-Libraries/issues/103
|
||||
get_target_property(property Vulkan::LayerSettings INTERFACE_COMPILE_OPTIONS)
|
||||
if (NOT property STREQUAL "property-NOTFOUND")
|
||||
message(FATAL_ERROR "Vulkan::LayerSettings shouldn't export compile options! ${property}")
|
||||
endif()
|
||||
get_target_property(property Vulkan::UtilityHeaders INTERFACE_COMPILE_OPTIONS)
|
||||
if (NOT property STREQUAL "property-NOTFOUND")
|
||||
message(FATAL_ERROR "Vulkan::UtilityHeaders shouldn't export compile options! ${property}")
|
||||
endif()
|
||||
|
|
|
@ -13,11 +13,10 @@ include(GoogleTest)
|
|||
# Test vk_enum_string_helper.h
|
||||
add_executable(vk_enum_string_helper vk_enum_string_helper.cpp)
|
||||
|
||||
lunarg_target_compiler_configurations(vk_enum_string_helper VUL_WERROR)
|
||||
|
||||
target_include_directories(vk_enum_string_helper PRIVATE ${VUL_SOURCE_DIR}/include)
|
||||
target_link_libraries(vk_enum_string_helper PRIVATE
|
||||
Vulkan::Headers
|
||||
Vulkan::CompilerConfiguration
|
||||
GTest::gtest
|
||||
GTest::gtest_main
|
||||
magic_enum::magic_enum
|
||||
|
|
|
@ -12,8 +12,6 @@ include(GoogleTest)
|
|||
# test_layer_setting_util
|
||||
add_executable(test_layer_settings_util)
|
||||
|
||||
lunarg_target_compiler_configurations(test_layer_settings_util VUL_WERROR)
|
||||
|
||||
target_include_directories(test_layer_settings_util PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/src/layer
|
||||
)
|
||||
|
@ -27,6 +25,7 @@ target_link_libraries(test_layer_settings_util PRIVATE
|
|||
GTest::gtest_main
|
||||
Vulkan::Headers
|
||||
Vulkan::LayerSettings
|
||||
Vulkan::CompilerConfiguration
|
||||
)
|
||||
|
||||
gtest_discover_tests(test_layer_settings_util)
|
||||
|
@ -34,8 +33,6 @@ gtest_discover_tests(test_layer_settings_util)
|
|||
# test_layer_setting_api
|
||||
add_executable(test_layer_settings_api)
|
||||
|
||||
lunarg_target_compiler_configurations(test_layer_settings_api VUL_WERROR)
|
||||
|
||||
target_include_directories(test_layer_settings_api PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/src/layer
|
||||
)
|
||||
|
@ -49,6 +46,7 @@ target_link_libraries(test_layer_settings_api PRIVATE
|
|||
GTest::gtest_main
|
||||
Vulkan::Headers
|
||||
Vulkan::LayerSettings
|
||||
Vulkan::CompilerConfiguration
|
||||
)
|
||||
|
||||
gtest_discover_tests(test_layer_settings_api)
|
||||
|
@ -56,8 +54,6 @@ gtest_discover_tests(test_layer_settings_api)
|
|||
# test_layer_setting_cpp
|
||||
add_executable(test_layer_settings_cpp)
|
||||
|
||||
lunarg_target_compiler_configurations(test_layer_settings_cpp VUL_WERROR)
|
||||
|
||||
target_include_directories(test_layer_settings_cpp PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/src/layer
|
||||
)
|
||||
|
@ -71,6 +67,7 @@ target_link_libraries(test_layer_settings_cpp PRIVATE
|
|||
GTest::gtest_main
|
||||
Vulkan::Headers
|
||||
Vulkan::LayerSettings
|
||||
Vulkan::CompilerConfiguration
|
||||
)
|
||||
|
||||
gtest_discover_tests(test_layer_settings_cpp)
|
||||
|
@ -78,8 +75,6 @@ gtest_discover_tests(test_layer_settings_cpp)
|
|||
# test_layer_setting_env
|
||||
add_executable(test_layer_settings_env)
|
||||
|
||||
lunarg_target_compiler_configurations(test_layer_settings_env VUL_WERROR)
|
||||
|
||||
target_include_directories(test_layer_settings_env PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/src/layer
|
||||
)
|
||||
|
@ -93,6 +88,7 @@ target_link_libraries(test_layer_settings_env PRIVATE
|
|||
GTest::gtest_main
|
||||
Vulkan::Headers
|
||||
Vulkan::LayerSettings
|
||||
Vulkan::CompilerConfiguration
|
||||
)
|
||||
|
||||
gtest_discover_tests(test_layer_settings_env)
|
||||
|
@ -100,8 +96,6 @@ gtest_discover_tests(test_layer_settings_env)
|
|||
# test_layer_setting_file
|
||||
add_executable(test_layer_setting_file)
|
||||
|
||||
lunarg_target_compiler_configurations(test_layer_setting_file VUL_WERROR)
|
||||
|
||||
target_include_directories(test_layer_setting_file PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/src/layer
|
||||
)
|
||||
|
@ -115,6 +109,7 @@ target_link_libraries(test_layer_setting_file PRIVATE
|
|||
GTest::gtest_main
|
||||
Vulkan::Headers
|
||||
Vulkan::LayerSettings
|
||||
Vulkan::CompilerConfiguration
|
||||
)
|
||||
|
||||
gtest_discover_tests(test_layer_setting_file)
|
||||
|
@ -122,8 +117,6 @@ gtest_discover_tests(test_layer_setting_file)
|
|||
# test_layer_setting_cast
|
||||
add_executable(test_layer_setting_cast)
|
||||
|
||||
lunarg_target_compiler_configurations(test_layer_setting_cast VUL_WERROR)
|
||||
|
||||
target_include_directories(test_layer_setting_cast PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/src/layer
|
||||
)
|
||||
|
@ -137,6 +130,7 @@ target_link_libraries(test_layer_setting_cast PRIVATE
|
|||
GTest::gtest_main
|
||||
Vulkan::Headers
|
||||
Vulkan::LayerSettings
|
||||
Vulkan::CompilerConfiguration
|
||||
)
|
||||
|
||||
gtest_discover_tests(test_layer_setting_cast)
|
||||
|
|
|
@ -11,12 +11,11 @@ include(GoogleTest)
|
|||
|
||||
add_executable(test_vk_dispatch_table test_interface.cpp)
|
||||
|
||||
lunarg_target_compiler_configurations(test_vk_dispatch_table VUL_WERROR)
|
||||
|
||||
target_link_libraries(test_vk_dispatch_table PRIVATE
|
||||
GTest::gtest
|
||||
GTest::gtest_main
|
||||
Vulkan::UtilityHeaders
|
||||
Vulkan::CompilerConfiguration
|
||||
)
|
||||
|
||||
target_include_directories(test_vk_dispatch_table PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue