From d7a093a45508c5265a28ae50fbf6731f55004a0a Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Tue, 4 Jun 2019 00:07:11 -0600 Subject: [PATCH] CMake: Define LIBP3DTOOL_FILENAMES for p3dtoolutil --- dtool/src/dtoolutil/CMakeLists.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/dtool/src/dtoolutil/CMakeLists.txt b/dtool/src/dtoolutil/CMakeLists.txt index 8348442311..efc0dbdc97 100644 --- a/dtool/src/dtoolutil/CMakeLists.txt +++ b/dtool/src/dtoolutil/CMakeLists.txt @@ -117,6 +117,32 @@ foreach(var endforeach(var) +if(BUILD_SHARED_LIBS) + # executionEnvironment.cxx needs to know the name(s) of the library file it + # will be linked into + if(BUILD_METALIBS) + set(library "p3dtool") + else() + set(library "p3dtoolutil") + endif() + + set(filenames) + foreach(prop TARGET_FILE_NAME TARGET_SONAME_FILE_NAME TARGET_LINKER_FILE_NAME) + list(APPEND filenames "$<${prop}:${library}>") + + if(CMAKE_IMPORT_LIBRARY_SUFFIX) + # Only the first property is valid/relevant on DLL platforms; bail out + # now and skip the others. + # (Yes, CMAKE_IMPORT_LIBRARY_SUFFIX being non-empty is how CMake defines + # a DLL platform where TARGET_SONAME_FILE_NAME is invalid.) + break() + endif() + endforeach(prop) + + target_compile_definitions(p3dtoolutil + PRIVATE "LIBP3DTOOL_FILENAMES=\"$\">\"") +endif() + if(NOT BUILD_METALIBS) install(TARGETS p3dtoolutil EXPORT Core COMPONENT Core