Skip to content

Commit

Permalink
Add download only and check to see if template functions already load…
Browse files Browse the repository at this point in the history
…ed, do not let lower level repos override them
  • Loading branch information
Cliff Foster committed Feb 29, 2024
1 parent de6157b commit d7a60bc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions cmake/idi/functions/framework/idi_init.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ macro(idi_init)

# Define a nice short hand for 3rd party external library folders
set(IDICMAKE_EXTERNAL_LIB_DIR "${CMAKE_CURRENT_LIST_DIR}/lib")
set(IDICMAKE_EXTERNAL_THIRD_PARTY_LIB_DIR "${CMAKE_CURRENT_LIST_DIR}/lib/.third-party")

idi_add_third_party_dependency(Catch2 https://github.com/catchorg/Catch2.git v3.5.2)

Expand Down
12 changes: 8 additions & 4 deletions cmake/idi/functions/idi_add_dependency.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ function(idi_get_repo_information REPO_DIR)
endfunction()

function(__idi_add_dependency IDI_DEP_NAME IDI_DEP_URL IDI_DEP_TAG IDI_DEP_THIRD_PARTY)
set(options DOWNLOAD_ONLY)
set(multiValueArgs DEP_OPTIONS)
cmake_parse_arguments(IDI "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN} )
Expand Down Expand Up @@ -180,10 +181,13 @@ function(__idi_add_dependency IDI_DEP_NAME IDI_DEP_URL IDI_DEP_TAG IDI_DEP_THIRD
cpm_parse_option("${OPTION}")
set(${OPTION_KEY} "${OPTION_VALUE}")
endforeach()
if (IDI_DEP_THIRD_PARTY)
add_subdirectory(${IDI_DEP_SOURCE_DIR} ${IDI_DEP_BINARY_DIR} EXCLUDE_FROM_ALL SYSTEM)
else()
add_subdirectory(${IDI_DEP_SOURCE_DIR} ${IDI_DEP_BINARY_DIR})

if(NOT IDI_DOWNLOAD_ONLY)
if (IDI_DEP_THIRD_PARTY)
add_subdirectory(${IDI_DEP_SOURCE_DIR} ${IDI_DEP_BINARY_DIR} EXCLUDE_FROM_ALL SYSTEM)
else()
add_subdirectory(${IDI_DEP_SOURCE_DIR} ${IDI_DEP_BINARY_DIR})
endif()
endif()
message(STATUS "Added dependency ${IDI_DEP_NAME}")
endfunction()
Expand Down
4 changes: 3 additions & 1 deletion cmake/idi/idi-template.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/idi/version.cmake)

include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/idi/updater/updater.cmake")

if(NOT IDICMAKE_DID_UPDATE)
if(NOT IDICMAKE_DID_UPDATE AND NOT IDICMAKE_TEMPLATE_LOADED)
if (IDICMAKE_ROOT_CML_V LESS IDICMAKE_ROOT_REQ_CML_V)
message(FATAL_ERROR "The root CMakeLists.txt is not at the required version for the IDI CMake framework."
"If you updated the template recently, also update the CMakeList.txt in the root directory")
Expand Down Expand Up @@ -45,4 +45,6 @@ if(NOT IDICMAKE_DID_UPDATE)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/idi/functions/framework/idi_src.cmake)

include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/idi/third-party/code-coverage.cmake)

set(IDICMAKE_TEMPLATE_LOADED true)
endif()

0 comments on commit d7a60bc

Please sign in to comment.