Skip to content

Commit 0c2c134

Browse files
authored
[CMake] Use cmake and fetch mechanism for windeppack (#5614)
Use subdiretory and fetch mechanism for WindDepPAck to automatise it while leacing the possibility to modify it
1 parent 208f309 commit 0c2c134

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

CMakeLists.txt

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,19 +142,14 @@ if(MSVC)
142142
option(SOFA_USE_DEPENDENCY_PACK "Enable the use of the Windows Dependency Pack" ON)
143143
# WinDepPack
144144
if(SOFA_USE_DEPENDENCY_PACK)
145-
set(SOFA_DEPENDENCY_PACK_DIR "${CMAKE_SOURCE_DIR}" CACHE PATH "Directory containing Windows Dependency Pack")
146-
if(NOT EXISTS ${SOFA_DEPENDENCY_PACK_DIR})
147-
# force back to default value
148-
set(SOFA_DEPENDENCY_PACK_DIR "${CMAKE_SOURCE_DIR}" CACHE PATH "Directory containing Windows Dependency Pack" FORCE)
145+
set(SOFA_DEPENDENCY_PACK_DIR "" CACHE PATH "Directory containing Windows Dependency Pack")
146+
if(SOFA_DEPENDENCY_PACK_DIR AND EXISTS ${SOFA_DEPENDENCY_PACK_DIR})
147+
add_subdirectory(${SOFA_DEPENDENCY_PACK_DIR} ${CMAKE_BINARY_DIR}/extlibs/SofaDependencyPack)
148+
else ()
149+
message(INFO "Fetching WinDepPack")
150+
sofa_fetch_dependency(WinDepPack GIT_REPOSITORY "https://github.com/sofa-framework/WinDepPack.git" GIT_TAG "master" DONT_BUILD)
151+
add_subdirectory("${CMAKE_BINARY_DIR}/external_directories/fetched/WinDepPack" "${CMAKE_BINARY_DIR}/extlibs/WinDepPack")
149152
endif()
150-
list(APPEND CMAKE_INCLUDE_PATH ${SOFA_DEPENDENCY_PACK_DIR}/include)
151-
if(CMAKE_CL_64)
152-
list(APPEND CMAKE_LIBRARY_PATH ${SOFA_DEPENDENCY_PACK_DIR}/lib/win64)
153-
else()
154-
list(APPEND CMAKE_LIBRARY_PATH ${SOFA_DEPENDENCY_PACK_DIR}/lib/win32)
155-
endif()
156-
install(DIRECTORY ${SOFA_DEPENDENCY_PACK_DIR}/include/ DESTINATION include/extlibs/WinDepPack COMPONENT headers)
157-
install(DIRECTORY ${SOFA_DEPENDENCY_PACK_DIR}/licenses/ DESTINATION licenses COMPONENT applications)
158153
endif ()
159154
endif()
160155

0 commit comments

Comments
 (0)