From 65b314a44e92d5e07d943e7523455ad4d391dfaa Mon Sep 17 00:00:00 2001 From: Yoann Potinet Date: Fri, 7 Aug 2020 13:06:10 -0400 Subject: [PATCH] Fix shared library build --- CMakeLists.txt | 5 ++++- DebugUtils/CMakeLists.txt | 8 ++------ Detour/CMakeLists.txt | 8 ++------ DetourCrowd/CMakeLists.txt | 8 ++------ DetourTileCache/CMakeLists.txt | 8 ++------ Recast/CMakeLists.txt | 8 ++------ 6 files changed, 14 insertions(+), 31 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 54a38d8..b8af6d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,10 @@ SET(VERSION 1.0.0) option(RECASTNAVIGATION_DEMO "Build demo" ON) option(RECASTNAVIGATION_TESTS "Build tests" ON) option(RECASTNAVIGATION_EXAMPLES "Build examples" ON) -option(RECASTNAVIGATION_STATIC "Build static libraries" ON) + +if(MSVC AND BUILD_SHARED_LIBS) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +endif() include(GNUInstallDirs) diff --git a/DebugUtils/CMakeLists.txt b/DebugUtils/CMakeLists.txt index 30fe626..21d8f8f 100644 --- a/DebugUtils/CMakeLists.txt +++ b/DebugUtils/CMakeLists.txt @@ -1,10 +1,5 @@ file(GLOB SOURCES Source/*.cpp) - -if (RECASTNAVIGATION_STATIC) - add_library(DebugUtils STATIC ${SOURCES}) -else() - add_library(DebugUtils SHARED ${SOURCES}) -endif() +add_library(DebugUtils ${SOURCES}) add_library(RecastNavigation::DebugUtils ALIAS DebugUtils) set_target_properties(DebugUtils PROPERTIES DEBUG_POSTFIX -d) @@ -29,6 +24,7 @@ set_target_properties(DebugUtils PROPERTIES ) install(TARGETS DebugUtils + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library diff --git a/Detour/CMakeLists.txt b/Detour/CMakeLists.txt index 74f9fc0..5cb47ec 100644 --- a/Detour/CMakeLists.txt +++ b/Detour/CMakeLists.txt @@ -1,10 +1,5 @@ file(GLOB SOURCES Source/*.cpp) - -if(RECASTNAVIGATION_STATIC) - add_library(Detour STATIC ${SOURCES}) -else() - add_library(Detour SHARED ${SOURCES}) -endif() +add_library(Detour ${SOURCES}) add_library(RecastNavigation::Detour ALIAS Detour) set_target_properties(Detour PROPERTIES DEBUG_POSTFIX -d) @@ -23,6 +18,7 @@ set_target_properties(Detour PROPERTIES ) install(TARGETS Detour + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library diff --git a/DetourCrowd/CMakeLists.txt b/DetourCrowd/CMakeLists.txt index 4ea8d8a..d0e186b 100644 --- a/DetourCrowd/CMakeLists.txt +++ b/DetourCrowd/CMakeLists.txt @@ -1,10 +1,5 @@ file(GLOB SOURCES Source/*.cpp) - -if (RECASTNAVIGATION_STATIC) - add_library(DetourCrowd STATIC ${SOURCES}) -else () - add_library(DetourCrowd SHARED ${SOURCES}) -endif () +add_library(DetourCrowd ${SOURCES}) add_library(RecastNavigation::DetourCrowd ALIAS DetourCrowd) set_target_properties(DetourCrowd PROPERTIES DEBUG_POSTFIX -d) @@ -27,6 +22,7 @@ set_target_properties(DetourCrowd PROPERTIES ) install(TARGETS DetourCrowd + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library diff --git a/DetourTileCache/CMakeLists.txt b/DetourTileCache/CMakeLists.txt index 7a8936b..3703ebb 100644 --- a/DetourTileCache/CMakeLists.txt +++ b/DetourTileCache/CMakeLists.txt @@ -1,10 +1,5 @@ file(GLOB SOURCES Source/*.cpp) - -if (RECASTNAVIGATION_STATIC) - add_library(DetourTileCache STATIC ${SOURCES}) -else () - add_library(DetourTileCache SHARED ${SOURCES}) -endif () +add_library(DetourTileCache ${SOURCES}) add_library(RecastNavigation::DetourTileCache ALIAS DetourTileCache) set_target_properties(DetourTileCache PROPERTIES DEBUG_POSTFIX -d) @@ -28,6 +23,7 @@ set_target_properties(DetourTileCache PROPERTIES install(TARGETS DetourTileCache + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library diff --git a/Recast/CMakeLists.txt b/Recast/CMakeLists.txt index 60a2036..3606544 100644 --- a/Recast/CMakeLists.txt +++ b/Recast/CMakeLists.txt @@ -1,10 +1,5 @@ file(GLOB SOURCES Source/*.cpp) - -if (RECASTNAVIGATION_STATIC) - add_library(Recast STATIC ${SOURCES}) -else () - add_library(Recast SHARED ${SOURCES}) -endif () +add_library(Recast ${SOURCES}) add_library(RecastNavigation::Recast ALIAS Recast) set_target_properties(Recast PROPERTIES DEBUG_POSTFIX -d) @@ -23,6 +18,7 @@ set_target_properties(Recast PROPERTIES ) install(TARGETS Recast + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library