Skip to content
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ if(NOT ${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
else()
set(CPM_RELEASE TRUE)
endif()
# Trick to use the find_package
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/CPM.cmake" "${CMAKE_CURRENT_BINARY_DIR}/CPM.cmake" COPYONLY
)
set(CPM_DIR "${CMAKE_CURRENT_BINARY_DIR}")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really necessary. In my tests, these are not set upstream. I don't understand how but:

  • CPM_DIR (set in this file) and CURRENT_CPM_VERSION (set in the include(cmake/CPM.cmake)) do not propagate upstream
  • But we can still use the macro/functions defined in cmake/CPM.cmake

include(cmake/CPM.cmake)
endif()

Expand Down