dev cmake_source_dir (#1052)

* when package used as subdirectory (cmake-subfolder-example) it fails when python is used because the cmake_source_dir is now the one above package.

* changed cmake_current_list_dir to cmake_current_source_dir

* removing the unnecessary VERSION file installed in the root directory (from PR #1020)
This commit is contained in:
maliakal_d 2024-11-25 14:55:22 +01:00 committed by GitHub
parent 0123169e35
commit 1f16f84fed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 6 deletions

View File

@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.14)
project(slsDetectorPackage) project(slsDetectorPackage)
# Read VERSION file into project version # Read VERSION file into project version
set(VERSION_FILE "${CMAKE_CURRENT_LIST_DIR}/VERSION") set(VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/VERSION")
file(READ "${VERSION_FILE}" VERSION_CONTENT) file(READ "${VERSION_FILE}" VERSION_CONTENT)
string(STRIP "${VERSION_CONTENT}" PROJECT_VERSION_STRING) string(STRIP "${VERSION_CONTENT}" PROJECT_VERSION_STRING)
set(PROJECT_VERSION ${PROJECT_VERSION_STRING}) set(PROJECT_VERSION ${PROJECT_VERSION_STRING})
@ -316,7 +316,7 @@ if (SLS_USE_PYTHON)
# https://github.com/pybind/pybind11/releases # https://github.com/pybind/pybind11/releases
FetchContent_Declare( FetchContent_Declare(
pybind11 pybind11
URL ${CMAKE_SOURCE_DIR}/libs/pybind11/v2.13.0.tar.gz URL ${CMAKE_CURRENT_SOURCE_DIR}/libs/pybind11/v2.13.0.tar.gz
URL_HASH MD5=10cb1efba3aca997389d08bceb0ea767 URL_HASH MD5=10cb1efba3aca997389d08bceb0ea767
) )
endif() endif()
@ -356,5 +356,3 @@ if(SLS_MASTER_PROJECT)
set(PROJECT_LIBRARIES slsSupportShared slsDetectorShared slsReceiverShared) set(PROJECT_LIBRARIES slsSupportShared slsDetectorShared slsReceiverShared)
include(cmake/package_config.cmake) include(cmake/package_config.cmake)
endif() endif()
install(FILES ${CMAKE_CURRENT_LIST_DIR}/VERSION DESTINATION ${CMAKE_INSTALL_PREFIX})

View File

@ -64,7 +64,7 @@ configure_file( scripts/test_virtual.py
${CMAKE_BINARY_DIR}/test_virtual.py ${CMAKE_BINARY_DIR}/test_virtual.py
) )
configure_file( ${CMAKE_CURRENT_LIST_DIR}/../VERSION configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/../VERSION
${CMAKE_BINARY_DIR}/bin/slsdet/VERSION ${CMAKE_BINARY_DIR}/bin/slsdet/VERSION
) )