Use targets CMake logic instead of directories

Replace the last usages of CMake logic that applied compiler definitions and
options to the folder with usage of a target.
This commit is contained in:
Charles Giessen 2022-02-16 21:44:09 -07:00 committed by Charles Giessen
parent 02c4578121
commit fa7b4fde64
2 changed files with 6 additions and 8 deletions

View File

@ -27,9 +27,6 @@ set(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM OFF)
project(Vulkan-Loader) project(Vulkan-Loader)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS API_NAME="Vulkan")
if (UPDATE_DEPS) if (UPDATE_DEPS)
find_package(PythonInterp 3 REQUIRED) find_package(PythonInterp 3 REQUIRED)
@ -256,6 +253,7 @@ else()
endif() endif()
add_library(loader_common_options INTERFACE) add_library(loader_common_options INTERFACE)
target_compile_definitions(loader_common_options INTERFACE API_NAME="Vulkan")
target_link_libraries(loader_common_options INTERFACE platform_wsi_defines) target_link_libraries(loader_common_options INTERFACE platform_wsi_defines)
# Enable beta Vulkan extensions # Enable beta Vulkan extensions
@ -333,17 +331,17 @@ endif()
if(UNIX) if(UNIX)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS FALLBACK_CONFIG_DIRS="${FALLBACK_CONFIG_DIRS}" FALLBACK_DATA_DIRS="${FALLBACK_DATA_DIRS}") target_compile_definitions(loader_common_options INTERFACE FALLBACK_CONFIG_DIRS="${FALLBACK_CONFIG_DIRS}" FALLBACK_DATA_DIRS="${FALLBACK_DATA_DIRS}")
if(NOT (SYSCONFDIR STREQUAL "")) if(NOT (SYSCONFDIR STREQUAL ""))
# SYSCONFDIR is specified, use it and do not force /etc. # SYSCONFDIR is specified, use it and do not force /etc.
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS SYSCONFDIR="${SYSCONFDIR}") target_compile_definitions(loader_common_options INTERFACE SYSCONFDIR="${SYSCONFDIR}")
else() else()
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS SYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}") target_compile_definitions(loader_common_options INTERFACE SYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
# Make sure /etc is searched by the loader # Make sure /etc is searched by the loader
if(NOT (CMAKE_INSTALL_FULL_SYSCONFDIR STREQUAL "/etc")) if(NOT (CMAKE_INSTALL_FULL_SYSCONFDIR STREQUAL "/etc"))
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS EXTRASYSCONFDIR="/etc") target_compile_definitions(loader_common_options INTERFACE EXTRASYSCONFDIR="/etc")
endif() endif()
endif() endif()
endif() endif()

View File

@ -200,7 +200,7 @@ else() # i.e.: Linux
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "^i.86$") elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "^i.86$")
check_include_file("cet.h" HAVE_CET_H) check_include_file("cet.h" HAVE_CET_H)
if(HAVE_CET_H) if(HAVE_CET_H)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS HAVE_CET_H) target_compile_definitions(loader_specific_options INTERFACE HAVE_CET_H)
endif() endif()
try_compile(ASSEMBLER_WORKS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/asm_test_x86.S) try_compile(ASSEMBLER_WORKS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/asm_test_x86.S)