This commit is contained in:
Andrei Astafev 2022-10-04 21:02:40 +03:00
parent add53c681c
commit e467ebd1b4
7 changed files with 32 additions and 33 deletions

View File

@ -9,6 +9,7 @@ get_filename_component(MYX_CMAKE_SOURCE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTO
set(MYX_CMAKE_BACKPORTS_DIR "${MYX_CMAKE_SOURCE_DIR}/backports") set(MYX_CMAKE_BACKPORTS_DIR "${MYX_CMAKE_SOURCE_DIR}/backports")
set(MYX_CMAKE_LIB_DIR "${MYX_CMAKE_SOURCE_DIR}/lib") set(MYX_CMAKE_LIB_DIR "${MYX_CMAKE_SOURCE_DIR}/lib")
include(${MYX_CMAKE_LIB_DIR}/macro/CreateSymlink.cmake)
include(${MYX_CMAKE_LIB_DIR}/macro/FindPackages.cmake) include(${MYX_CMAKE_LIB_DIR}/macro/FindPackages.cmake)
include(${MYX_CMAKE_LIB_DIR}/macro/InstallRelative.cmake) include(${MYX_CMAKE_LIB_DIR}/macro/InstallRelative.cmake)
@ -18,6 +19,7 @@ if(${CMAKE_VERSION} VERSION_LESS "3.11.0")
include(${MYX_CMAKE_BACKPORTS_DIR}/FetchContent.cmake) include(${MYX_CMAKE_BACKPORTS_DIR}/FetchContent.cmake)
endif() endif()
include(${MYX_CMAKE_LIB_DIR}/PopulateCMakeBinaryDir.cmake)
include(${MYX_CMAKE_LIB_DIR}/Includes.cmake) include(${MYX_CMAKE_LIB_DIR}/Includes.cmake)
include(${MYX_CMAKE_LIB_DIR}/CurrentDate.cmake) include(${MYX_CMAKE_LIB_DIR}/CurrentDate.cmake)
include(${MYX_CMAKE_LIB_DIR}/ColoredMessages.cmake) include(${MYX_CMAKE_LIB_DIR}/ColoredMessages.cmake)

View File

@ -1,4 +1,4 @@
set(MYX_CMAKE_PACKAGE_VERSION "1.99.82") set(MYX_CMAKE_PACKAGE_VERSION "1.99.83")
if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) if(MYX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE) set(PACKAGE_VERSION_COMPATIBLE FALSE)
else() else()

View File

@ -36,10 +36,10 @@ if(MYX_CMAKE_DIR)
set(ENV{MYX_CMAKE_DIR} ${MYX_CMAKE_DIR}) set(ENV{MYX_CMAKE_DIR} ${MYX_CMAKE_DIR})
endif() endif()
if(DEFINED ENV{MYX_CMAKE_DIR}) if(DEFINED ENV{MYX_CMAKE_DIR})
find_package(MyxCMake 1.99.82 REQUIRED) find_package(MyxCMake 1.99.83 REQUIRED)
else() else()
if(MYX_CMAKE_USE_SYSTEM) if(MYX_CMAKE_USE_SYSTEM)
find_package(MyxCMake 1.99.82 REQUIRED) find_package(MyxCMake 1.99.83 REQUIRED)
else() else()
include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake) include(${PROJECT_SOURCE_DIR}/cmake/myx/MyxCMakeConfig.cmake)
endif() endif()

View File

@ -1 +1 @@
1.99.82 1.99.83

View File

@ -0,0 +1,15 @@
include_guard(GLOBAL)
# Создание в каталоге ${CMAKE_BINARY_DIR} стандартных каталогов bin,include,lib,
# а также символических ссылок на каталоги в ${CMAKE_SOURCE_DIR}/files
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/include)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/include)
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
create_symlink("${CMAKE_SOURCE_DIR}/files/etc" "${CMAKE_BINARY_DIR}/etc")
create_symlink("${CMAKE_SOURCE_DIR}/files/log" "${CMAKE_BINARY_DIR}/log")
create_symlink("${CMAKE_SOURCE_DIR}/files/share" "${CMAKE_BINARY_DIR}/share")
create_symlink("${CMAKE_SOURCE_DIR}/files/var" "${CMAKE_BINARY_DIR}/var")

View File

@ -12,31 +12,6 @@ function(myx_target_setup NAME)
myx_message_fatal_error("Target ${NAME} does not exists.") myx_message_fatal_error("Target ${NAME} does not exists.")
endif() endif()
# Создание в каталоге ${CMAKE_BINARY_DIR} стандартных каталогов bin,include,lib,
# а также символических ссылок на каталоги в ${CMAKE_SOURCE_DIR}/files
if(NOT TARGET ${NAME}-populate-cmake-binary-dir)
add_custom_target(
${NAME}-populate-cmake-binary-dir
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/bin
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/lib
# Ссылка на каталог с журналами
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/files/log
${CMAKE_BINARY_DIR}/log
# Ссылка на каталог с обрабатываемыми данными
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/files/var
${CMAKE_BINARY_DIR}/var
# Ссылка на каталог с постоянными данными
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/files/share
${CMAKE_BINARY_DIR}/share
# Ссылка на каталог настроек
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/files/etc
${CMAKE_BINARY_DIR}/etc
)
add_dependencies(${NAME} ${NAME}-populate-cmake-binary-dir)
endif()
get_target_property(target_type ${NAME} TYPE) get_target_property(target_type ${NAME} TYPE)
foreach(iter ${ARG_PACKAGES}) foreach(iter ${ARG_PACKAGES})
@ -69,10 +44,6 @@ function(myx_target_setup NAME)
set_property(TARGET ${NAME} APPEND PROPERTY PRIVATE_HEADER_FILES "${ARG_PCH}") set_property(TARGET ${NAME} APPEND PROPERTY PRIVATE_HEADER_FILES "${ARG_PCH}")
endif() endif()
if(NOT IS_DIRECTORY "${PROJECT_BINARY_DIR}/include")
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/include")
endif()
if(NOT target_type STREQUAL "INTERFACE_LIBRARY") if(NOT target_type STREQUAL "INTERFACE_LIBRARY")
target_include_directories(${PROJECT_NAME} PRIVATE target_include_directories(${PROJECT_NAME} PRIVATE
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>) $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>)

View File

@ -0,0 +1,11 @@
include_guard(GLOBAL)
macro(create_symlink original linkname)
if(NOT EXISTS ${linkname})
if(${CMAKE_VERSION} VERSION_LESS "3.14.0")
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${original} ${linkname})
else()
file(CREATE_LINK ${original} ${linkname} SYMBOLIC)
endif()
endif()
endmacro(create_symlink original linkname)