Skip to content

Commit

Permalink
Update enabled and disable projects based on changes in USE_* flags.
Browse files Browse the repository at this point in the history
  • Loading branch information
starseeker committed Mar 7, 2024
1 parent d9e846a commit 8ff7d51
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -271,17 +271,27 @@ function(add_project pname)
cmake_parse_arguments(A "" "" "GROUPS" ${ARGN})
string(TOUPPER "${pname}" UPNAME)
string(REPLACE "-" "_" UPNAME "${UPNAME}")
set(${UPNAME}_ADDED 1 PARENT_SCOPE)
if (NOT A_GROUPS)
add_subdirectory(${pname})
set(${UPNAME}_ADDED 1 PARENT_SCOPE)
return()
endif (NOT A_GROUPS)
set(is_added FALSE)
foreach(grp ${A_GROUPS})
if (USE_${grp})
add_subdirectory(${pname})
return()
set(is_added TRUE)
set(${UPNAME}_ADDED 1 PARENT_SCOPE)
break()
endif (USE_${grp})
endforeach(grp ${A_GROUPS})
if (NOT is_added)
if (ENABLE_${UPNAME})
message("Disabling ${pname} due to disabled USE flags")
endif (ENABLE_${UPNAME})
execute_process(COMMAND ${CMAKE_COMMAND} -E rm -rf ${CMAKE_BINARY_DIR}/${pname})
unset(ENABLE_${UPNAME} CACHE)
endif (NOT is_added)
endfunction(add_project pname)

###############################################################################
Expand Down Expand Up @@ -529,12 +539,12 @@ add_project(gdal GROUPS "GDAL")

# pugixml - a light-weight C++ XML processing library
# https://pugixml.org/
add_project(pugixml GROUPS "BRLCAD_EXTRA;APPLESEED")
add_project(pugixml GROUPS "BRLCAD;APPLESEED")

# Open Asset Import Library - library for supporting I/O for a number of
# Geometry file formats
# https://github.com/assimp/assimp
add_project(assetimport GROUPS "BRLCAD_EXTRA")
add_project(assetimport GROUPS "BRLCAD")

# OpenCV - Open Source Computer Vision Library
# http://opencv.org
Expand Down

0 comments on commit 8ff7d51

Please sign in to comment.