Skip to content

Commit 2aa686f

Browse files
committed
Set CMake properties consistently
Simplifies the code Idiomatic way of setting visibility via CMake
1 parent 1fc2f17 commit 2aa686f

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

CMakeLists.txt

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ project(VULKAN_LOADER VERSION 1.3.274 LANGUAGES C)
2020

2121
add_subdirectory(scripts)
2222

23+
set(CMAKE_C_STANDARD 99)
24+
set(CMAKE_C_STANDARD_REQUIRED ON)
25+
set(CMAKE_C_EXTENSIONS OFF)
26+
set(CMAKE_C_VISIBILITY_PRESET "hidden")
27+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
28+
2329
# By default, loader & tests are built without sanitizers
2430
# Use these options to force a specific sanitizer on the loader and test executables
2531
if (UNIX)
@@ -129,12 +135,6 @@ target_link_libraries(loader_common_options INTERFACE platform_wsi)
129135
# Enable beta Vulkan extensions
130136
target_compile_definitions(loader_common_options INTERFACE VK_ENABLE_BETA_EXTENSIONS)
131137

132-
target_compile_features(loader_common_options INTERFACE c_std_99)
133-
set(LOADER_STANDARD_C_PROPERTIES C_STANDARD 99 C_STANDARD_REQUIRED YES C_EXTENSIONS OFF)
134-
135-
# Force the use of the multithreaded, static version of the C runtime.
136-
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
137-
138138
option(BUILD_WERROR "Enable warnings as errors")
139139

140140
# Set warnings as errors and the main diagnostic flags
@@ -163,10 +163,6 @@ if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
163163
endif()
164164
endif()
165165

166-
if(UNIX)
167-
target_compile_options(loader_common_options INTERFACE -fvisibility=hidden)
168-
endif()
169-
170166
target_compile_options(loader_common_options INTERFACE -Wpointer-arith)
171167
endif()
172168

loader/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -460,11 +460,6 @@ endif()
460460
# common attributes of the vulkan library
461461
target_link_libraries(vulkan PRIVATE loader_specific_options)
462462

463-
set_target_properties(vulkan PROPERTIES ${LOADER_STANDARD_C_PROPERTIES})
464-
if (TARGET asm_offset)
465-
set_target_properties(asm_offset PROPERTIES ${LOADER_STANDARD_C_PROPERTIES})
466-
endif()
467-
468463
target_link_libraries(vulkan PRIVATE Vulkan::Headers)
469464
add_library(Vulkan::Loader ALIAS vulkan)
470465

0 commit comments

Comments
 (0)