diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 12dc3b0d4..3b5c530a5 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -1100,8 +1100,6 @@ if(MSVC10) endif() endif() -ADD_DEFINITIONS( -DASSIMP_BUILD_DLL_EXPORT ) - IF( MSVC OR "${CMAKE_CXX_SIMULATE_ID}" MATCHES "MSVC") # clang with MSVC ABI ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS ) ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS ) @@ -1178,6 +1176,13 @@ ENDIF() ADD_LIBRARY( assimp ${assimp_src} ) ADD_LIBRARY(assimp::assimp ALIAS assimp) +# Remove any dllexport tags when building a static library. +IF (BUILD_SHARED_LIBS) + TARGET_COMPILE_DEFINITIONS(assimp PRIVATE ASSIMP_BUILD_DLL_EXPORT) +ELSE () + TARGET_COMPILE_DEFINITIONS(assimp PRIVATE OPENDDL_STATIC_LIBARY) +ENDIF () + TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp) IF (ASSIMP_WARNINGS_AS_ERRORS)