Путь к модулям CMLib

This commit is contained in:
Andrei Astafev 2019-02-13 21:34:20 +03:00
parent 7302444663
commit 959a730ec6
6 changed files with 18 additions and 9 deletions

View File

@ -20,6 +20,6 @@ function(add_common_library LIBNAME SOURCES)
set_target_properties(${LIBNAME}_static PROPERTIES set_target_properties(${LIBNAME}_static PROPERTIES
OUTPUT_NAME ${LIBNAME} OUTPUT_NAME ${LIBNAME}
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR}) ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR})
configure_file(${CMAKE_SOURCE_DIR}/cmake/cmlib/pc/lib.pc.in ${CMAKE_BINARY_DIR}/${LIBNAME}.pc) configure_file(${CMLIB_MODULE_DIR}/pc/lib.pc.in ${CMAKE_BINARY_DIR}/${LIBNAME}.pc)
endfunction() endfunction()

View File

@ -2,5 +2,5 @@ function(cmlib_config_hpp_generate)
get_property(VERSION_INT GLOBAL PROPERTY VERSION_INT) get_property(VERSION_INT GLOBAL PROPERTY VERSION_INT)
get_property(VERSION_STR GLOBAL PROPERTY VERSION_STR) get_property(VERSION_STR GLOBAL PROPERTY VERSION_STR)
get_property(ORGANIZATION_NAME GLOBAL PROPERTY ORGANIZATION_NAME) get_property(ORGANIZATION_NAME GLOBAL PROPERTY ORGANIZATION_NAME)
configure_file(${CMAKE_SOURCE_DIR}/cmake/cmlib/hpp/config.hpp.in ${CMAKE_BINARY_DIR}/include/config.hpp) configure_file(${CMLIB_MODULE_DIR}/hpp/config.hpp.in ${CMAKE_BINARY_DIR}/include/config.hpp)
endfunction() endfunction()

View File

@ -3,3 +3,12 @@ string(TOUPPER ${PROJECT_NAME} _project_name_uppercase)
string(REGEX REPLACE "[ -]" "_" _project_name_fixed ${_project_name_uppercase}) string(REGEX REPLACE "[ -]" "_" _project_name_fixed ${_project_name_uppercase})
set(CMLIB_PROJECT_NAME_CANONICAL ${_project_name_fixed}) set(CMLIB_PROJECT_NAME_CANONICAL ${_project_name_fixed})
# CMLIB_MODULE_DIR
set(CMLIB_MODULE_DIR "")
foreach(_m ${CMAKE_MODULE_PATH})
if(EXISTS ${_m}/CMLibCommon.cmake)
get_filename_component(CMLIB_MODULE_DIR ${_m}/CMLibCommon.cmake DIRECTORY)
break()
endif()
endforeach()

View File

@ -10,7 +10,7 @@ macro(test_large_files VARIABLE USE_64_SUFFIX)
# First try without any macros defined # First try without any macros defined
try_compile(LARGE_FILES_SUPPORTED "${CMAKE_BINARY_DIR}" try_compile(LARGE_FILES_SUPPORTED "${CMAKE_BINARY_DIR}"
"${CMAKE_MODULE_PATH}/tests/LargeFiles${SUFFIX_64}.c" "${CMLIB_MODULE_DIR}/tests/LargeFiles${SUFFIX_64}.c"
OUTPUT_VARIABLE TRY_LARGE_FILES_OUTPUT) OUTPUT_VARIABLE TRY_LARGE_FILES_OUTPUT)
if(VERBOSE_LARGE_FILES) if(VERBOSE_LARGE_FILES)
@ -20,7 +20,7 @@ macro(test_large_files VARIABLE USE_64_SUFFIX)
if(NOT LARGE_FILES_SUPPORTED) if(NOT LARGE_FILES_SUPPORTED)
# Try with C macro _FILE_OFFSET_BITS=64 # Try with C macro _FILE_OFFSET_BITS=64
try_compile(LARGE_FILES_SUPPORTED "${CMAKE_BINARY_DIR}" try_compile(LARGE_FILES_SUPPORTED "${CMAKE_BINARY_DIR}"
"${CMAKE_MODULE_PATH}/tests/LargeFiles${SUFFIX_64}.c" "${CMLIB_MODULE_DIR}/tests/LargeFiles${SUFFIX_64}.c"
COMPILE_DEFINITIONS "-D_FILE_OFFSET_BITS=64" COMPILE_DEFINITIONS "-D_FILE_OFFSET_BITS=64"
OUTPUT_VARIABLE TRY_LARGE_FILES_OUTPUT) OUTPUT_VARIABLE TRY_LARGE_FILES_OUTPUT)
@ -37,7 +37,7 @@ macro(test_large_files VARIABLE USE_64_SUFFIX)
# Try with C macro _LARGEFILE_SOURCE # Try with C macro _LARGEFILE_SOURCE
try_compile(LARGE_FILES_SUPPORTED "${CMAKE_BINARY_DIR}" try_compile(LARGE_FILES_SUPPORTED "${CMAKE_BINARY_DIR}"
"${CMAKE_MODULE_PATH}/tests/LargeFiles${SUFFIX_64}.c" "${CMLIB_MODULE_DIR}/tests/LargeFiles${SUFFIX_64}.c"
COMPILE_DEFINITIONS "-D_LARGEFILE${SUFFIX_64}_SOURCE" COMPILE_DEFINITIONS "-D_LARGEFILE${SUFFIX_64}_SOURCE"
OUTPUT_VARIABLE TRY_LARGE_FILES_OUTPUT) OUTPUT_VARIABLE TRY_LARGE_FILES_OUTPUT)
@ -53,7 +53,7 @@ macro(test_large_files VARIABLE USE_64_SUFFIX)
if(NOT LARGE_FILES_SUPPORTED) if(NOT LARGE_FILES_SUPPORTED)
# Try with both C macro _FILE_OFFSET_BITS=64 and _LARGEFILE_SOURCE # Try with both C macro _FILE_OFFSET_BITS=64 and _LARGEFILE_SOURCE
try_compile(LARGE_FILES_SUPPORTED "${CMAKE_BINARY_DIR}" try_compile(LARGE_FILES_SUPPORTED "${CMAKE_BINARY_DIR}"
"${CMAKE_MODULE_PATH}/tests/LargeFiles${SUFFIX_64}.c" "${CMLIB_MODULE_DIR}/tests/LargeFiles${SUFFIX_64}.c"
COMPILE_DEFINITIONS "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE${SUFFIX_64}_SOURCE" COMPILE_DEFINITIONS "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE${SUFFIX_64}_SOURCE"
OUTPUT_VARIABLE TRY_LARGE_FILES_OUTPUT) OUTPUT_VARIABLE TRY_LARGE_FILES_OUTPUT)
@ -70,7 +70,7 @@ macro(test_large_files VARIABLE USE_64_SUFFIX)
if(NOT LARGE_FILES_SUPPORTED) if(NOT LARGE_FILES_SUPPORTED)
# Maybe we are using the Windows C standard library # Maybe we are using the Windows C standard library
try_compile(LARGE_FILES_SUPPORTED "${CMAKE_BINARY_DIR}" try_compile(LARGE_FILES_SUPPORTED "${CMAKE_BINARY_DIR}"
"${CMAKE_MODULE_PATH}/tests/LargeFilesWindows.c") "${CMLIB_MODULE_DIR}/tests/LargeFilesWindows.c")
endif(NOT LARGE_FILES_SUPPORTED) endif(NOT LARGE_FILES_SUPPORTED)
if(LARGE_FILES_SUPPORTED) if(LARGE_FILES_SUPPORTED)

View File

@ -40,7 +40,7 @@ function(qt_translation)
COMMAND ${Qt5_LUPDATE_EXECUTABLE} ARGS ${_sources_list} -ts ${_ts_list} COMMAND ${Qt5_LUPDATE_EXECUTABLE} ARGS ${_sources_list} -ts ${_ts_list}
DEPENDS ${_sources_list}) DEPENDS ${_sources_list})
configure_file(${CMAKE_SOURCE_DIR}/cmake/cmlib/qrc/l10n.qrc.in ${CMAKE_BINARY_DIR}/${_target}_l10n.qrc) configure_file(${CMLIB_MODULE_DIR}/qrc/l10n.qrc.in ${CMAKE_BINARY_DIR}/${_target}_l10n.qrc)
qt5_add_resources(_qrc ${CMAKE_BINARY_DIR}/${_target}_l10n.qrc) qt5_add_resources(_qrc ${CMAKE_BINARY_DIR}/${_target}_l10n.qrc)
add_custom_target(_qrc_target DEPENDS ${_qrc}) add_custom_target(_qrc_target DEPENDS ${_qrc})

View File

@ -1,6 +1,6 @@
if(NOT TARGET uninstall) if(NOT TARGET uninstall)
configure_file( configure_file(
"${CMAKE_SOURCE_DIR}/cmake/cmlib/CMLibUninstall.cmake.in" "${CMLIB_MODULE_DIR}/CMLibUninstall.cmake.in"
"${CMAKE_BINARY_DIR}/cmake_uninstall.cmake" "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY) IMMEDIATE @ONLY)