You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Config] Add new macro for fetching dependencies (#5550)
* Introduce new macro for fetching external dependencies
* Use macro in code base
* remove unused macro
* Fix CImg
* Avoid fetching when CMake is disconnected
* Add Local dir mechanism
* WIP, use the macro for plugins
* Finalize use of the macro for plugins
message(FATAL_ERROR"Sofa.GUI.Common: DEPENDENCY cxxopts NOT FOUND. SOFA_ALLOW_FETCH_DEPENDENCIES is OFF and thus cannot be fetched. Install libcxxopts-dev (version>=3.1.0), or enable SOFA_ALLOW_FETCH_DEPENDENCIES to fix this issue.")
message(SEND_ERROR"${name}: Specified directory ${${upper_name}_LOCAL_DIRECTORY} doesn't exist.""\nPlease provide a directory containing the fetched project, or use option ${fetch_enabled} to automatically fetch it.")
message(SEND_ERROR"Directory ${${upper_name}_LOCAL_DIRECTORY} given in ${upper_name}_LOCAL_DIRECTORY doesn't seem to be a right github repository.")
256
+
elseif (NOT ARG_DONT_BUILD AND FETCHCONTENT_FULLY_DISCONNECTED OR FETCHCONTENT_UPDATES_DISCONNECTED)
257
+
message(SEND_ERROR"FETCHCONTENT_FULLY_DISCONNECTED or FETCHCONTENT_UPDATES_DISCONNECTED is ON but the dependency hasn't been fetched correctly before. Please reconnect fetching mechanism or provide a local directory by setting ${upper_name}_LOCAL_DIRECTORY.")
258
+
endif()
259
+
endmacro()
260
+
261
+
262
+
263
+
### External projects management
264
+
# Thanks to http://crascit.com/2015/07/25/cmake-gtest/
265
+
#
266
+
# Use this macro (subdirectory or plugin version) to add out-of-repository projects.
267
+
# Usage:
268
+
# 1. Add repository configuration in MyProjectDir/ExternalProjectConfig.cmake.in
message(FATAL_ERROR"${PROJECT_NAME}: DEPENDENCY googletest NOT FOUND. SOFA_ALLOW_FETCH_DEPENDENCIES is OFF and thus cannot be fetched. Install googletest, or enable SOFA_ALLOW_FETCH_DEPENDENCIES to fix this issue.")
Copy file name to clipboardExpand all lines: applications/plugins/CImgPlugin/CMakeLists.txt
+4-8Lines changed: 4 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -25,18 +25,14 @@ sofa_find_package(CImg QUIET)
25
25
if(NOT CImg_FOUND AND SOFA_ALLOW_FETCH_DEPENDENCIES)
26
26
message("CImgPlugin: DEPENDENCY CImg NOT FOUND. SOFA_ALLOW_FETCH_DEPENDENCIES is ON, fetching CImg...")
27
27
28
-
include(FetchContent)
29
-
FetchContent_Declare(CImg
28
+
sofa_fetch_dependency(CImg
30
29
GIT_REPOSITORYhttps://github.com/GreycLab/CImg
31
30
GIT_TAGv.3.3.2
31
+
DONT_BUILD
32
32
)
33
33
34
-
FetchContent_GetProperties(CImg)
35
-
if(NOT CImg_POPULATED)
36
-
FetchContent_Populate(CImg)
37
-
set(CIMG_DIR ${cimg_SOURCE_DIR})
38
-
sofa_find_package(CImgREQUIRED)
39
-
endif()
34
+
set(CIMG_DIR ${CImg_SOURCE_DIR})
35
+
sofa_find_package(CImgREQUIRED)
40
36
elseif (NOT CImg_FOUND)
41
37
message(FATAL_ERROR"CImgPlugin: DEPENDENCY CImg NOT FOUND. SOFA_ALLOW_FETCH_DEPENDENCIES is OFF and thus cannot be fetched. Install cimg-dev, or enable SOFA_ALLOW_FETCH_DEPENDENCIES to fix this issue.")
message(FATAL_ERROR"SofaMatrix: DEPENDENCY metis NOT FOUND. SOFA_ALLOW_FETCH_DEPENDENCIES is OFF and thus cannot be fetched. Install metis (version=5.1.0), or enable SOFA_ALLOW_FETCH_DEPENDENCIES to fix this issue.")
18
+
message(FATAL_ERROR"Sofa.Metis: DEPENDENCY metis NOT FOUND. SOFA_ALLOW_FETCH_DEPENDENCIES is OFF and thus cannot be fetched. Install metis (version=5.1.0), or enable SOFA_ALLOW_FETCH_DEPENDENCIES to fix this issue.")
0 commit comments