myx-cmake/MyxCMake/functions/MyxCMakeGenerateGitInfoHeader.cmake

20 lines
763 B
CMake
Raw Permalink Normal View History

2021-12-08 11:32:04 +00:00
function(myx_cmake_generate_git_info_header)
2021-12-22 13:27:32 +00:00
set(output_file ${CMAKE_BINARY_DIR}/include/myx_cmake_git_info_p.hpp)
2021-12-08 11:32:04 +00:00
if(MYX_CMAKE_GENERATED_HEADERS_PATH)
2021-12-22 11:27:40 +00:00
set(output_file ${MYX_CMAKE_GENERATED_HEADERS_PATH}/myx_cmake_git_info_p.hpp)
2021-12-08 11:32:04 +00:00
elseif(ARGV0)
set(output_file ${ARGV0})
endif()
# cmake-format: off
if(NOT TARGET myx-cmake-git-info-header)
add_custom_target(myx-cmake-git-info-header ALL
${CMAKE_COMMAND} -DMYX_CMAKE_PROJECT_NAME_UPPER=${MYX_CMAKE_PROJECT_NAME_UPPER}
2021-12-09 11:41:26 +00:00
-DMYX_CMAKE_FUNCTIONS_DIR=${MYX_CMAKE_FUNCTIONS_DIR}
-DMYX_CMAKE_GIT_INFO_FILE=${output_file} -P ${MYX_CMAKE_FUNCTIONS_DIR}/MyxCMakeGitInfo.cmake
2021-12-08 11:32:04 +00:00
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endif()
# cmake-format: on
endfunction()