Merge pull request #22 from LesleyLai/master

Create alias cmake target
This commit is contained in:
Charles Giessen 2020-03-25 13:15:41 -06:00 committed by GitHub
commit d8ea155798
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ project(VulkanBootstrap)
find_package(Vulkan REQUIRED) find_package(Vulkan REQUIRED)
add_library(vk-bootstrap src/VkBootstrap.h src/VkBootstrap.cpp) add_library(vk-bootstrap src/VkBootstrap.h src/VkBootstrap.cpp)
add_library(vk-bootstrap::vk-bootstrap ALIAS vk-bootstrap)
target_include_directories(vk-bootstrap PUBLIC src) target_include_directories(vk-bootstrap PUBLIC src)
@ -12,8 +13,8 @@ target_link_libraries(vk-bootstrap PRIVATE ${Vulkan_LIBRARY})
target_compile_features(vk-bootstrap PUBLIC cxx_std_11) target_compile_features(vk-bootstrap PUBLIC cxx_std_11)
target_compile_options( target_compile_options(
vk-bootstrap vk-bootstrap
PRIVATE PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>: $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall -Wall
-Wextra -Wextra
@ -25,19 +26,19 @@ target_compile_options(
/W4>) /W4>)
option(VK_BOOTSTRAP_TEST "Test Vk-Bootstrap with glfw and Catch2" OFF) option(VK_BOOTSTRAP_TEST "Test Vk-Bootstrap with glfw and Catch2" OFF)
if(VK_BOOTSTRAP_TEST) if (VK_BOOTSTRAP_TEST)
set(GLFW_BUILD_TESTS set(GLFW_BUILD_TESTS
OFF OFF
CACHE BOOL "" FORCE) CACHE BOOL "" FORCE)
set(GLFW_BUILD_DOCS set(GLFW_BUILD_DOCS
OFF OFF
CACHE BOOL "" FORCE) CACHE BOOL "" FORCE)
set(GLFW_INSTALL set(GLFW_INSTALL
OFF OFF
CACHE BOOL "" FORCE) CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES set(GLFW_BUILD_EXAMPLES
OFF OFF
CACHE BOOL "" FORCE) CACHE BOOL "" FORCE)
add_subdirectory(ext/glfw) add_subdirectory(ext/glfw)
add_subdirectory(ext/Catch2) add_subdirectory(ext/Catch2)
@ -52,10 +53,10 @@ if(VK_BOOTSTRAP_TEST)
target_link_libraries(vk-bootstrap-triangle glfw) target_link_libraries(vk-bootstrap-triangle glfw)
add_custom_command( add_custom_command(
TARGET vk-bootstrap-triangle TARGET vk-bootstrap-triangle
POST_BUILD POST_BUILD
COMMAND COMMAND
${CMAKE_COMMAND} -E copy_directory ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/example/shaders ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/example/shaders ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}) DEPENDS ${CMAKE_CURRENT_BINARY_DIR})
endif() endif ()