Skip to content

Commit 32440b6

Browse files
committed
CMake fix transitive target properties, and macos rpath handling
prepending target properties with INTERFACE_ makes the property transitive to consumers. add normal MSVC_RUNTIME_LIBRARY to windows properties add INTERFACE_ to BUILD_RPATH_USE_ORIGIN add INTERFACE_ to POSITION_INDEPENDENT_CODE add INTERFACE_ to OSX_ARCHITECTURES enable INTERFACE_MACOSX_RPATH for origin rpath on macos
1 parent c6af953 commit 32440b6

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

cmake/godotcpp.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,9 @@ function( godotcpp_generate )
298298
CXX_VISIBILITY_PRESET ${GODOT_SYMBOL_VISIBILITY}
299299

300300
COMPILE_WARNING_AS_ERROR ${GODOT_WARNING_AS_ERROR}
301+
301302
POSITION_INDEPENDENT_CODE ON
302-
BUILD_RPATH_USE_ORIGIN ON
303+
INTERFACE_POSITION_INDEPENDENT_CODE ON
303304

304305
PREFIX lib
305306
OUTPUT_NAME "${PROJECT_NAME}.${SYSTEM_NAME}.${TARGET_ALIAS}${DEV_TAG}.${SYSTEM_ARCH}"

cmake/macos.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ function( macos_generate )
3636
set_target_properties( ${TARGET_NAME}
3737
PROPERTIES
3838

39+
# Specify multiple architectures for universal builds
3940
OSX_ARCHITECTURES "${OSX_ARCH}"
41+
GODOT_ARCH ${SYSTEM_ARCH}
4042
)
4143

4244
target_compile_definitions(${TARGET_NAME}

test/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,15 @@ if( CMAKE_SYSTEM_NAME STREQUAL Darwin )
5555

5656
set_target_properties( godot-cpp-test
5757
PROPERTIES
58-
LIBRARY_OUTPUT_DIRECTORY "$<1:${OUTPUT_DIR}>"
59-
RUNTIME_OUTPUT_DIRECTORY "$<1:${OUTPUT_DIR}>"
6058

6159
OUTPUT_NAME "gdexample.macos.${TEST_TARGET}${DEV}"
6260
SUFFIX ""
6361

6462
#macos options
6563
OSX_ARCHITECTURES "${OSX_ARCH}"
64+
65+
# enable RPATH on MACOS, with the BUILD_RPATH_USE_ORIGIN
66+
# this should allow loading libraries from relative paths on macos.
67+
MACOSX_RPATH ON
6668
)
6769
endif ()

0 commit comments

Comments
 (0)