Skip to content

Commit d47cd6a

Browse files
committed
Fix CMP0065
This one definitely broke OpenMW when we bumped our minimum CMake version past 3.5, but that meant that we already knew about it and already knew how to fix it and which platforms were affected.
1 parent 4d04fea commit d47cd6a

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

CMakeModules/OsgMacroUtils.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,14 @@ MACRO(SETUP_EXE IS_COMMANDLINE_APP)
355355
ENDIF()
356356
ENDIF()
357357

358+
IF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND DYNAMIC_OPENSCENEGRAPH)
359+
# templated types used in OSG plugins and applications need to get the same type ID
360+
# based on investigation for https://gitlab.com/OpenMW/openmw/-/issues/8039 by the OpenMW team, this is believed to only be necessary for Clang on Linux
361+
# i.e. not for GCC anywhere, MSVC on Windows or for AppleClang on MacOS
362+
# it's possible that this is really required by the C++ spec for all platforms and we're just getting away with it everywhere else
363+
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES ENABLE_EXPORTS ON)
364+
ENDIF()
365+
358366
SETUP_LINK_LIBRARIES()
359367

360368
ENDMACRO(SETUP_EXE)

examples/osgCMakeExample/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,11 @@ LINK_DIRECTORIES(${OSG_LIB_DIR})
2222
ADD_EXECUTABLE(${PROJECT_NAME} ${SOURCES})
2323

2424
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OSG_LIBRARIES} ${OSGVIEWER_LIBRARIES} ${OSGUTIL_LIBRARIES} ${OSGDB_LIBRARIES} ${OSGGA_LIBRARIES} ${OPENTHREADS_LIBRARIES})
25+
26+
IF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
27+
# templated types used in OSG plugins and applications need to get the same type ID
28+
# based on investigation for https://gitlab.com/OpenMW/openmw/-/issues/8039 by the OpenMW team, this is believed to only be necessary for Clang on Linux
29+
# i.e. not for GCC anywhere, MSVC on Windows or for AppleClang on MacOS
30+
# it's possible that this is really required by the C++ spec for all platforms and we're just getting away with it everywhere else
31+
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES ENABLE_EXPORTS ON)
32+
ENDIF()

0 commit comments

Comments
 (0)