Путь к автогенерируемым заголовочным файлам

This commit is contained in:
Andrei Astafev 2022-05-06 14:19:47 +03:00
parent c5d11a80b7
commit 489fd9fc14
2 changed files with 9 additions and 9 deletions

View File

@ -2,7 +2,7 @@ include_guard(GLOBAL)
function(myx_cmake_generate_git_info_header) function(myx_cmake_generate_git_info_header)
set(_filename ${CMAKE_BINARY_DIR}/${CMAKE_INCLUDE_DIR}/${MYX_CMAKE_PROJECT_NAME_LOWER}/myx_cmake_git_info_p.hpp) set(_filename ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${MYX_CMAKE_PROJECT_NAME_LOWER}/myx_cmake_git_info_p.hpp)
if(MYX_CMAKE_GENERATED_HEADERS_PATH) if(MYX_CMAKE_GENERATED_HEADERS_PATH)
set(_filename ${MYX_CMAKE_GENERATED_HEADERS_PATH}/${MYX_CMAKE_PROJECT_NAME_LOWER}/myx_cmake_git_info_p.hpp) set(_filename ${MYX_CMAKE_GENERATED_HEADERS_PATH}/${MYX_CMAKE_PROJECT_NAME_LOWER}/myx_cmake_git_info_p.hpp)
elseif(ARGV0) elseif(ARGV0)
@ -56,20 +56,20 @@ if(GIT_EXECUTABLE)
# Check whether we got any revision (which isn't always the case, # Check whether we got any revision (which isn't always the case,
# e.g. when someone downloaded a zip file from Github instead of a checkout) # e.g. when someone downloaded a zip file from Github instead of a checkout)
if(NOT ${MYX_CMAKE_GIT_REV} STREQUAL \"\") if(NOT \"\${MYX_CMAKE_GIT_REV}\" STREQUAL \"\")
execute_process(COMMAND bash -c \"git diff --quiet --exit-code || echo +\" OUTPUT_VARIABLE MYX_CMAKE_GIT_DIFF) execute_process(COMMAND bash -c \"git diff --quiet --exit-code || echo +\" OUTPUT_VARIABLE MYX_CMAKE_GIT_DIFF)
execute_process(COMMAND git describe --exact-match --tags OUTPUT_VARIABLE MYX_CMAKE_GIT_TAG ERROR_QUIET) execute_process(COMMAND git describe --exact-match --tags OUTPUT_VARIABLE MYX_CMAKE_GIT_TAG ERROR_QUIET)
execute_process(COMMAND git rev-parse --abbrev-ref HEAD OUTPUT_VARIABLE MYX_CMAKE_GIT_BRANCH) execute_process(COMMAND git rev-parse --abbrev-ref HEAD OUTPUT_VARIABLE MYX_CMAKE_GIT_BRANCH)
string(STRIP \"${MYX_CMAKE_GIT_REV}\" MYX_CMAKE_GIT_REV) string(STRIP \"\${MYX_CMAKE_GIT_REV}\" MYX_CMAKE_GIT_REV)
string(SUBSTRING \"${MYX_CMAKE_GIT_REV}\" 1 7 MYX_CMAKE_GIT_REV) string(SUBSTRING \"\${MYX_CMAKE_GIT_REV}\" 1 7 MYX_CMAKE_GIT_REV)
string(STRIP \"${MYX_CMAKE_GIT_DIFF}\" MYX_CMAKE_GIT_DIFF) string(STRIP \"\${MYX_CMAKE_GIT_DIFF}\" MYX_CMAKE_GIT_DIFF)
string(STRIP \"${MYX_CMAKE_GIT_TAG}\" MYX_CMAKE_GIT_TAG) string(STRIP \"\${MYX_CMAKE_GIT_TAG}\" MYX_CMAKE_GIT_TAG)
string(STRIP \"${MYX_CMAKE_GIT_BRANCH}\" MYX_CMAKE_GIT_BRANCH) string(STRIP \"\${MYX_CMAKE_GIT_BRANCH}\" MYX_CMAKE_GIT_BRANCH)
endif() endif()
endif() endif()
configure_file(${_git_info_hpp_in_path} ${MYX_CMAKE_GIT_INFO_FILE}) configure_file(${_git_info_hpp_in_path} \"\${MYX_CMAKE_GIT_INFO_FILE}\")
") ")
set(_git_info_cmake_in_path ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/MyxCMakeGitInfo.cmake.in) set(_git_info_cmake_in_path ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/MyxCMakeGitInfo.cmake.in)
file(WRITE ${_git_info_cmake_in_path} ${_git_info_cmake_in}) file(WRITE ${_git_info_cmake_in_path} ${_git_info_cmake_in})

View File

@ -5,7 +5,7 @@ function(myx_cmake_generate_private_config_header)
include(MyxCMakeLargeFiles) include(MyxCMakeLargeFiles)
myx_cmake_test_large_files(HAVE_LARGEFILES) myx_cmake_test_large_files(HAVE_LARGEFILES)
set(_filename ${CMAKE_BINARY_DIR}/${CMAKE_INCLUDE_DIR}/${MYX_CMAKE_PROJECT_NAME_LOWER}/myx_cmake_private_config_p.hpp) set(_filename ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${MYX_CMAKE_PROJECT_NAME_LOWER}/myx_cmake_private_config_p.hpp)
if(MYX_CMAKE_GENERATED_HEADERS_PATH) if(MYX_CMAKE_GENERATED_HEADERS_PATH)
set(_filename ${MYX_CMAKE_GENERATED_HEADERS_PATH}/${MYX_CMAKE_PROJECT_NAME_LOWER}/myx_cmake_private_config_p.hpp) set(_filename ${MYX_CMAKE_GENERATED_HEADERS_PATH}/${MYX_CMAKE_PROJECT_NAME_LOWER}/myx_cmake_private_config_p.hpp)
elseif(ARGV0) elseif(ARGV0)