Skip to content

Commit 0c3345d

Browse files
committed
[cmake] use target_compile_definitions
which is considered best practice.
1 parent 1bef878 commit 0c3345d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

build/cmake/lib/CMakeLists.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ endif()
112112

113113
macro (add_definition target var)
114114
if (NOT ("${${var}}" STREQUAL ""))
115-
set_property(TARGET ${target} APPEND PROPERTY COMPILE_DEFINITIONS "${var}=__attribute__((visibility(\"${${var}}\")))")
115+
target_compile_definitions(${target} PUBLIC "${var}=__attribute__((visibility(\"${${var}}\")))")
116116
endif ()
117117
endmacro ()
118118

@@ -126,7 +126,7 @@ if (ZSTD_BUILD_SHARED)
126126
target_include_directories(libzstd_shared INTERFACE $<BUILD_INTERFACE:${PUBLIC_INCLUDE_DIRS}>)
127127
list(APPEND library_targets libzstd_shared)
128128
if (ZSTD_MULTITHREAD_SUPPORT)
129-
set_property(TARGET libzstd_shared APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_MULTITHREAD")
129+
target_compile_definitions(libzstd_shared PUBLIC ZSTD_MULTITHREAD)
130130
if (UNIX)
131131
target_link_libraries(libzstd_shared ${THREADS_LIBS})
132132
endif ()
@@ -140,7 +140,7 @@ if (ZSTD_BUILD_STATIC)
140140
target_include_directories(libzstd_static INTERFACE $<BUILD_INTERFACE:${PUBLIC_INCLUDE_DIRS}>)
141141
list(APPEND library_targets libzstd_static)
142142
if (ZSTD_MULTITHREAD_SUPPORT)
143-
set_property(TARGET libzstd_static APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_MULTITHREAD")
143+
target_compile_definitions(libzstd_static PUBLIC ZSTD_MULTITHREAD)
144144
if (UNIX)
145145
target_link_libraries(libzstd_static ${THREADS_LIBS})
146146
endif ()
@@ -207,7 +207,7 @@ if (ZSTD_BUILD_SHARED)
207207
OUTPUT_NAME zstd
208208
VERSION ${ZSTD_FULL_VERSION}
209209
SOVERSION ${zstd_VERSION_MAJOR})
210-
210+
211211
if (ZSTD_FRAMEWORK)
212212
set_target_properties(
213213
libzstd_shared

0 commit comments

Comments
 (0)