Skip to content

Commit a3db93e

Browse files
committed
Work around for CMake 3.15 Resource file linking
CMake 3.15 doesn't properly include resource files when linking by being passed a target which means Windows doesn't include the Olson timezone data. Instead as a work around, link against the target object using target_link_options.
1 parent e506c04 commit a3db93e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Foundation/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ target_compile_options(Foundation PUBLIC
142142
"SHELL:-Xcc -F${CMAKE_BINARY_DIR}")
143143
target_compile_options(Foundation PRIVATE
144144
"SHELL:-Xcc -I${ICU_INCLUDE_DIR}")
145+
if(CMAKE_SYSTEM_NAME STREQUAL Windows AND CMAKE_VERSION VERSION_LESS 3.16)
146+
# Work around for CMake 15 which doesn't link in the resource file
147+
# target properly
148+
add_dependencies(Foundation CoreFoundationResources)
149+
target_link_options(Foundation PRIVATE $<TARGET_OBJECTS:CoreFoundationResources>)
150+
endif()
145151
if(ENABLE_TESTING)
146152
target_compile_options(Foundation PRIVATE
147153
-enable-testing)

0 commit comments

Comments
 (0)