diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d46315..0737d7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,10 +57,10 @@ set(IONC_FULL_VERSION ${CMAKE_PROJECT_VERSION}) find_program(GIT_EXECUTABLE "git") add_custom_target( version - ${CMAKE_COMMAND} -D SRC=${CMAKE_SOURCE_DIR}/build_version.h.in - -D DST=${CMAKE_BINARY_DIR}/build_version.h + ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_SOURCE_DIR}/build_version.h.in + -D DST=${CMAKE_CURRENT_BINARY_DIR}/build_version.h -D GIT_EXECUTABLE=${GIT_EXECUTABLE} - -P ${CMAKE_SOURCE_DIR}/cmake/VersionHeader.cmake + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/VersionHeader.cmake ) include(GNUInstallDirs) diff --git a/cmake/VersionHeader.cmake b/cmake/VersionHeader.cmake index 95a0adc..2bdcd36 100644 --- a/cmake/VersionHeader.cmake +++ b/cmake/VersionHeader.cmake @@ -5,6 +5,7 @@ if (GIT_EXECUTABLE) OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT RESULT_VARIABLE GIT_DESCRIBE_ERROR OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} ) if (NOT GIT_DESCRIBE_ERROR) # Describe output will be in the form v--g[-dirty] diff --git a/ionc/CMakeLists.txt b/ionc/CMakeLists.txt index 84661b4..be80b31 100644 --- a/ionc/CMakeLists.txt +++ b/ionc/CMakeLists.txt @@ -67,8 +67,7 @@ target_include_directories(objlib $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_BINARY_DIR} - + ${CMAKE_CURRENT_BINARY_DIR}/../ ) add_dependencies(objlib version)