Форматирование кода
This commit is contained in:
parent
209f64bd45
commit
f8837304e4
@ -3,7 +3,9 @@ set(CPACK_SOURCE_GENERATOR TXZ)
|
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION}")
|
||||
set(CPACK_IGNORE_FILE "cmake/etc/cpack_ignore.txt")
|
||||
file(STRINGS ${CPACK_IGNORE_FILE} CPACK_SOURCE_IGNORE_FILES)
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CPACK_IGNORE_FILE})
|
||||
set_property(DIRECTORY
|
||||
APPEND
|
||||
PROPERTY CMAKE_CONFIGURE_DEPENDS ${CPACK_IGNORE_FILE})
|
||||
include(CPack)
|
||||
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
# Создание статической и динамической библиотеки из одинаковых объектных файлов
|
||||
function(add_common_library LIBNAME SOURCES)
|
||||
add_library(${LIBNAME} OBJECT ${SOURCES})
|
||||
target_include_directories(${LIBNAME} PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
target_include_directories(
|
||||
${LIBNAME}
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include/${LIBNAME}>)
|
||||
set_target_properties(${LIBNAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
@ -10,16 +11,18 @@ function(add_common_library LIBNAME SOURCES)
|
||||
add_library(${LIBNAME}_shared SHARED $<TARGET_OBJECTS:${LIBNAME}>)
|
||||
get_property(_ver GLOBAL PROPERTY VERSION_STR)
|
||||
get_property(_sover GLOBAL PROPERTY VERSION_MAJOR)
|
||||
set_target_properties(${LIBNAME}_shared PROPERTIES
|
||||
VERSION ${_ver}
|
||||
set_target_properties(${LIBNAME}_shared
|
||||
PROPERTIES VERSION ${_ver}
|
||||
SOVERSION ${_sover}
|
||||
OUTPUT_NAME ${LIBNAME}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
add_library(${LIBNAME}_static STATIC $<TARGET_OBJECTS:${LIBNAME}>)
|
||||
set_target_properties(${LIBNAME}_static PROPERTIES
|
||||
OUTPUT_NAME ${LIBNAME}
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR})
|
||||
configure_file(${CMLIB_MODULE_DIR}/pc/lib.pc.in ${CMAKE_BINARY_DIR}/${LIBNAME}.pc)
|
||||
set_target_properties(${LIBNAME}_static
|
||||
PROPERTIES OUTPUT_NAME ${LIBNAME}
|
||||
ARCHIVE_OUTPUT_DIRECTORY
|
||||
${CMAKE_INSTALL_LIBDIR})
|
||||
configure_file(${CMLIB_MODULE_DIR}/pc/lib.pc.in
|
||||
${CMAKE_BINARY_DIR}/${LIBNAME}.pc)
|
||||
endfunction()
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
set(COMMON_CXX_FEATURES
|
||||
cxx_alias_templates cxx_nullptr cxx_override)
|
||||
set(COMMON_CXX_FEATURES cxx_alias_templates cxx_nullptr cxx_override)
|
||||
|
||||
function(common_target_properties Name)
|
||||
get_target_property(__type ${Name} TYPE)
|
||||
@ -9,8 +8,9 @@ function(common_target_properties Name)
|
||||
set(__visibility INTERFACE)
|
||||
endif()
|
||||
target_compile_features(${Name} ${__visibility} ${COMMON_CXX_FEATURES})
|
||||
target_include_directories(${Name} PUBLIC
|
||||
$<INSTALL_INTERFACE:include>
|
||||
target_include_directories(
|
||||
${Name}
|
||||
PUBLIC $<INSTALL_INTERFACE:include>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)
|
||||
@ -19,14 +19,18 @@ function(common_target_properties Name)
|
||||
endif()
|
||||
if(NOT __interface)
|
||||
if(TARGET Qt5::Core)
|
||||
target_compile_options(${Name} PUBLIC "${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
|
||||
target_compile_options(${Name}
|
||||
PUBLIC "${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
|
||||
set_target_properties(${Name} PROPERTIES AUTOMOC TRUE AUTORCC TRUE)
|
||||
endif()
|
||||
if(TARGET Qt5::Widgets)
|
||||
set_target_properties(${Name} PROPERTIES AUTOUIC TRUE)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.7.99)
|
||||
target_include_directories(${Name} PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}_autogen/include>)
|
||||
target_include_directories(
|
||||
${Name}
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}_autogen/include>
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER_IS_GCC AND NOT APPLE)
|
||||
|
@ -1,8 +1,8 @@
|
||||
# C compiler name
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "Intel")
|
||||
set(CMAKE_C_COMPILER_IS_INTEL ON)
|
||||
elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang" OR
|
||||
CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
|
||||
elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang"
|
||||
OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
|
||||
set(CMAKE_C_COMPILER_IS_CLANG ON)
|
||||
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
set(CMAKE_C_COMPILER_IS_GCC ON)
|
||||
@ -13,8 +13,8 @@ endif()
|
||||
# C++ compiler name
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
set(CMAKE_CXX_COMPILER_IS_INTEL ON)
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR
|
||||
CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
|
||||
OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
set(CMAKE_CXX_COMPILER_IS_CLANG ON)
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(CMAKE_CXX_COMPILER_IS_GCC ON)
|
||||
|
@ -18,93 +18,98 @@ macro(CHECK_ENABLE_CXX_FLAG flag)
|
||||
endmacro()
|
||||
|
||||
# Common configuration for GCC, clang and Intel.
|
||||
if(CMAKE_CXX_COMPILER_IS_CLANG OR CMAKE_CXX_COMPILER_IS_INTEL OR CMAKE_CXX_COMPILER_IS_GCC)
|
||||
if(CMAKE_CXX_COMPILER_IS_CLANG
|
||||
OR CMAKE_CXX_COMPILER_IS_INTEL
|
||||
OR CMAKE_CXX_COMPILER_IS_GCC)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
||||
set(CMAKE_CXX_EXTENSIONS YES)
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
CHECK_ENABLE_CXX_FLAG(-Wall)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wextra)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wnon-virtual-dtor)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wnoexcept)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wlogical-op)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wconversion)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wdeprecated)
|
||||
check_enable_cxx_flag(-Wall)
|
||||
check_enable_cxx_flag(-Wextra)
|
||||
check_enable_cxx_flag(-Wnon-virtual-dtor)
|
||||
check_enable_cxx_flag(-Wnoexcept)
|
||||
check_enable_cxx_flag(-Wlogical-op)
|
||||
check_enable_cxx_flag(-Wconversion)
|
||||
check_enable_cxx_flag(-Wdeprecated)
|
||||
# This limit is supposed to be at least 1024 in C++11, but for some reason
|
||||
# clang sets this to 256, and gcc to 900.
|
||||
CHECK_ENABLE_CXX_FLAG(-ftemplate-depth=1024)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wold-style-cast)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wdisabled-optimization)
|
||||
# This is useful when the compiler decides the template backtrace is too verbose.
|
||||
CHECK_ENABLE_CXX_FLAG(-ftemplate-backtrace-limit=0)
|
||||
CHECK_ENABLE_CXX_FLAG(-fstack-protector-all)
|
||||
check_enable_cxx_flag(-ftemplate-depth=1024)
|
||||
check_enable_cxx_flag(-Wold-style-cast)
|
||||
check_enable_cxx_flag(-Wdisabled-optimization)
|
||||
# This is useful when the compiler decides the template backtrace is too
|
||||
# verbose.
|
||||
check_enable_cxx_flag(-ftemplate-backtrace-limit=0)
|
||||
check_enable_cxx_flag(-fstack-protector-all)
|
||||
# A few suggestion flags.
|
||||
CHECK_ENABLE_CXX_FLAG(-Wsuggest-attribute=pure)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wsuggest-attribute=const)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wsuggest-attribute=noreturn)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wsuggest-attribute=format)
|
||||
check_enable_cxx_flag(-Wsuggest-attribute=pure)
|
||||
check_enable_cxx_flag(-Wsuggest-attribute=const)
|
||||
check_enable_cxx_flag(-Wsuggest-attribute=noreturn)
|
||||
check_enable_cxx_flag(-Wsuggest-attribute=format)
|
||||
# From GCC 5.
|
||||
CHECK_ENABLE_CXX_FLAG(-Wodr)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wsuggest-final-types)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wsuggest-final-methods)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wsuggest-override)
|
||||
check_enable_cxx_flag(-Wodr)
|
||||
check_enable_cxx_flag(-Wsuggest-final-types)
|
||||
check_enable_cxx_flag(-Wsuggest-final-methods)
|
||||
check_enable_cxx_flag(-Wsuggest-override)
|
||||
# From GCC 6.
|
||||
CHECK_ENABLE_CXX_FLAG(-Wshift-negative-value)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wshift-overflow=2)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wduplicated-cond)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wnull-dereference)
|
||||
check_enable_cxx_flag(-Wshift-negative-value)
|
||||
check_enable_cxx_flag(-Wshift-overflow=2)
|
||||
check_enable_cxx_flag(-Wduplicated-cond)
|
||||
check_enable_cxx_flag(-Wnull-dereference)
|
||||
# From GCC 7.
|
||||
CHECK_ENABLE_CXX_FLAG(-Wrestrict)
|
||||
CHECK_ENABLE_CXX_FLAG(-Waligned-new)
|
||||
check_enable_cxx_flag(-Wrestrict)
|
||||
check_enable_cxx_flag(-Waligned-new)
|
||||
# From GCC 8.
|
||||
CHECK_ENABLE_CXX_FLAG(-Wcast-align=strict)
|
||||
# This is supposed to produce a nice graphical visualization
|
||||
# of mismatching template errors.
|
||||
CHECK_ENABLE_CXX_FLAG(-fdiagnostics-show-template-tree)
|
||||
CHECK_ENABLE_CXX_FLAG(-fdiagnostics-show-option)
|
||||
check_enable_cxx_flag(-Wcast-align=strict)
|
||||
# This is supposed to produce a nice graphical visualization of mismatching
|
||||
# template errors.
|
||||
check_enable_cxx_flag(-fdiagnostics-show-template-tree)
|
||||
check_enable_cxx_flag(-fdiagnostics-show-option)
|
||||
|
||||
CHECK_ENABLE_CXX_FLAG(-pedantic)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wcast-align)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wcast-qual)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wctor-dtor-privacy)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wdisabled-optimization)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wformat=2)
|
||||
CHECK_ENABLE_CXX_FLAG(-Winit-self)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wmissing-include-dirs)
|
||||
CHECK_ENABLE_CXX_FLAG(-Woverloaded-virtual)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wredundant-decls)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wsign-promo)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wstrict-overflow=5)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wundef)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wno-unused)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wno-variadic-macros)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wno-parentheses)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wstrict-null-sentinel)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wshadow)
|
||||
CHECK_ENABLE_CXX_FLAG(-Wshadow-all)
|
||||
check_enable_cxx_flag(-pedantic)
|
||||
check_enable_cxx_flag(-Wcast-align)
|
||||
check_enable_cxx_flag(-Wcast-qual)
|
||||
check_enable_cxx_flag(-Wctor-dtor-privacy)
|
||||
check_enable_cxx_flag(-Wdisabled-optimization)
|
||||
check_enable_cxx_flag(-Wformat=2)
|
||||
check_enable_cxx_flag(-Winit-self)
|
||||
check_enable_cxx_flag(-Wmissing-include-dirs)
|
||||
check_enable_cxx_flag(-Woverloaded-virtual)
|
||||
check_enable_cxx_flag(-Wredundant-decls)
|
||||
check_enable_cxx_flag(-Wsign-promo)
|
||||
check_enable_cxx_flag(-Wstrict-overflow=5)
|
||||
check_enable_cxx_flag(-Wundef)
|
||||
check_enable_cxx_flag(-Wno-unused)
|
||||
check_enable_cxx_flag(-Wno-variadic-macros)
|
||||
check_enable_cxx_flag(-Wno-parentheses)
|
||||
check_enable_cxx_flag(-Wstrict-null-sentinel)
|
||||
check_enable_cxx_flag(-Wshadow)
|
||||
check_enable_cxx_flag(-Wshadow-all)
|
||||
endif()
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
CHECK_ENABLE_CXX_FLAG(-flto)
|
||||
if(CMAKE_CXX_COMPILER_IS_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.8")
|
||||
check_enable_cxx_flag(-flto)
|
||||
if(CMAKE_CXX_COMPILER_IS_GCC
|
||||
AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.8")
|
||||
# Doesn't work with GCC 4.7.2 in Astra Linux 1.5
|
||||
CHECK_ENABLE_CXX_FLAG(-fno-fat-lto-objects)
|
||||
check_enable_cxx_flag(-fno-fat-lto-objects)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_IS_GCC)
|
||||
CHECK_ENABLE_CXX_FLAG(-fdiagnostics-color=auto)
|
||||
# The -Wmaybe-uninitialized flag is enabled by -Wall, but it is known
|
||||
# to emit a lot of possibly spurious warnings. Let's just disable it.
|
||||
CHECK_ENABLE_CXX_FLAG(-Wno-maybe-uninitialized)
|
||||
check_enable_cxx_flag(-fdiagnostics-color=auto)
|
||||
# The -Wmaybe-uninitialized flag is enabled by -Wall,
|
||||
# but it is known to emit a lot of possibly spurious warnings.
|
||||
# Let's just disable it.
|
||||
check_enable_cxx_flag(-Wno-maybe-uninitialized)
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "5.999")
|
||||
# NOTE: GCC >= 6 seems to be wrongly warning about visibility attributes
|
||||
# in some situations:
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80947
|
||||
# Let's just disable the warning for now.
|
||||
CHECK_ENABLE_CXX_FLAG(-Wno-attributes)
|
||||
check_enable_cxx_flag(-Wno-attributes)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -5,5 +5,6 @@ function(cmlib_config_hpp_generate)
|
||||
get_property(VERSION_INT GLOBAL PROPERTY VERSION_INT)
|
||||
get_property(VERSION_STR GLOBAL PROPERTY VERSION_STR)
|
||||
get_property(ORGANIZATION_NAME GLOBAL PROPERTY ORGANIZATION_NAME)
|
||||
configure_file(${CMLIB_MODULE_DIR}/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()
|
||||
|
@ -17,13 +17,11 @@ file(GLOB_RECURSE _cmakelists_files RELATIVE ${_source_realpath} CMakeLists.txt)
|
||||
foreach(_it ${_cmakelists_files})
|
||||
get_filename_component(_file ${_it} REALPATH)
|
||||
get_filename_component(_dir ${_file} DIRECTORY)
|
||||
file(REMOVE_RECURSE
|
||||
${_dir}/CMakeFiles
|
||||
file(REMOVE_RECURSE ${_dir}/CMakeFiles
|
||||
${_dir}/CMakeCache.txt
|
||||
${_dir}/cmake_install.cmake
|
||||
${_dir}/Makefile
|
||||
${_dir}/build.ninja
|
||||
${_dir}/rules.ninja
|
||||
)
|
||||
${_dir}/rules.ninja)
|
||||
endforeach()
|
||||
|
||||
|
@ -10,11 +10,11 @@ macro(remove_flag_from_target _target _flag)
|
||||
get_target_property(_target_cxx_flags ${_target} COMPILE_OPTIONS)
|
||||
if(_target_cxx_flags)
|
||||
list(REMOVE_ITEM _target_cxx_flags ${_flag})
|
||||
set_target_properties(${_target} PROPERTIES COMPILE_OPTIONS "${_target_cxx_flags}")
|
||||
set_target_properties(${_target}
|
||||
PROPERTIES COMPILE_OPTIONS "${_target_cxx_flags}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
#
|
||||
# Removes the specified compiler flag from the specified file.
|
||||
# _target - The target that _file belongs to
|
||||
@ -41,16 +41,20 @@ macro(remove_flag_from_file _target _file _flag)
|
||||
# Apply the target compile flags to each source file.
|
||||
foreach(_source_file ${_target_sources})
|
||||
# Check for pre-existing flags set by set_source_files_properties().
|
||||
get_source_file_property(_source_file_cxx_flags ${_source_file} COMPILE_FLAGS)
|
||||
get_source_file_property(_source_file_cxx_flags ${_source_file}
|
||||
COMPILE_FLAGS)
|
||||
if(_source_file_cxx_flags)
|
||||
separate_arguments(_source_file_cxx_flags UNIX_COMMAND ${_source_file_cxx_flags})
|
||||
separate_arguments(_source_file_cxx_flags UNIX_COMMAND
|
||||
${_source_file_cxx_flags})
|
||||
list(APPEND _source_file_cxx_flags "${_target_cxx_flags}")
|
||||
else()
|
||||
set(_source_file_cxx_flags "${_target_cxx_flags}")
|
||||
endif()
|
||||
# Apply the compile flags to the current source file.
|
||||
string(REPLACE ";" " " _source_file_cxx_flags_string "${_source_file_cxx_flags}")
|
||||
set_source_files_properties(${_source_file} PROPERTIES COMPILE_FLAGS "${_source_file_cxx_flags_string}")
|
||||
string(REPLACE ";" " " _source_file_cxx_flags_string
|
||||
"${_source_file_cxx_flags}")
|
||||
set_source_files_properties(${_source_file} PROPERTIES COMPILE_FLAGS
|
||||
"${_source_file_cxx_flags_string}")
|
||||
endforeach()
|
||||
endif()
|
||||
list(FIND _target_sources ${_file} _file_found_at)
|
||||
@ -59,13 +63,18 @@ macro(remove_flag_from_file _target _file _flag)
|
||||
# Cache the compile flags for the specified file.
|
||||
# This is the list that we'll be removing flags from.
|
||||
get_source_file_property(_source_file_cxx_flags ${_file} COMPILE_FLAGS)
|
||||
separate_arguments(_source_file_cxx_flags UNIX_COMMAND ${_source_file_cxx_flags})
|
||||
set(_cached_${_target}_${_file}_cxx_flags ${_source_file_cxx_flags} CACHE INTERNAL "")
|
||||
separate_arguments(_source_file_cxx_flags UNIX_COMMAND
|
||||
${_source_file_cxx_flags})
|
||||
set(_cached_${_target}_${_file}_cxx_flags ${_source_file_cxx_flags}
|
||||
CACHE INTERNAL "")
|
||||
endif()
|
||||
# Remove the specified flag, then re-apply the rest.
|
||||
list(REMOVE_ITEM _cached_${_target}_${_file}_cxx_flags ${_flag})
|
||||
string(REPLACE ";" " " _cached_${_target}_${_file}_cxx_flags_string "${_cached_${_target}_${_file}_cxx_flags}")
|
||||
set_source_files_properties(${_file} PROPERTIES COMPILE_FLAGS "${_cached_${_target}_${_file}_cxx_flags_string}")
|
||||
string(REPLACE ";" " " _cached_${_target}_${_file}_cxx_flags_string
|
||||
"${_cached_${_target}_${_file}_cxx_flags}")
|
||||
set_source_files_properties(
|
||||
${_file} PROPERTIES COMPILE_FLAGS
|
||||
"${_cached_${_target}_${_file}_cxx_flags_string}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
@ -6,13 +6,16 @@ find_program(_lsb_release_executable lsb_release)
|
||||
|
||||
if(_lsb_release_executable)
|
||||
execute_process(COMMAND ${_lsb_release_executable} -sc
|
||||
OUTPUT_VARIABLE LSB_CODENAME OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
OUTPUT_VARIABLE LSB_CODENAME
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(COMMAND ${_lsb_release_executable} -sr
|
||||
OUTPUT_VARIABLE LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
OUTPUT_VARIABLE LSB_RELEASE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(COMMAND ${_lsb_release_executable} -si
|
||||
OUTPUT_VARIABLE LSB_DISTRIBUTOR_ID OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
OUTPUT_VARIABLE LSB_DISTRIBUTOR_ID
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
else()
|
||||
set(LSB_DISTRIBUTOR_ID "unknown")
|
||||
set(LSB_RELEASE "unknown")
|
||||
|
@ -6,7 +6,9 @@ function(set_organization_name)
|
||||
message(FATAL_ERROR "File ${ORGANIZATION_FILE} doesn't exist")
|
||||
endif()
|
||||
file(READ "${_organization_file}" _org)
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${_organization_file})
|
||||
set_property(DIRECTORY
|
||||
APPEND
|
||||
PROPERTY CMAKE_CONFIGURE_DEPENDS ${_organization_file})
|
||||
|
||||
if(NOT "${_org}" MATCHES "^([0-9A-Za-z ,.]+)\n")
|
||||
message(FATAL_ERROR "File ${_organization_file} has wrong format")
|
||||
|
@ -7,7 +7,9 @@ function(set_project_version)
|
||||
message(FATAL_ERROR "File ${_version_file} doesn't exists")
|
||||
endif()
|
||||
file(READ "${_version_file}" _version)
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${_version_file})
|
||||
set_property(DIRECTORY
|
||||
APPEND
|
||||
PROPERTY CMAKE_CONFIGURE_DEPENDS ${_version_file})
|
||||
|
||||
if(NOT "${_version}" MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)\n")
|
||||
message(FATAL_ERROR "${_version_file} has wrong format")
|
||||
@ -18,8 +20,11 @@ function(set_project_version)
|
||||
set_property(GLOBAL PROPERTY VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||
set_property(GLOBAL PROPERTY VERSION_MINOR ${CMAKE_MATCH_2})
|
||||
set_property(GLOBAL PROPERTY VERSION_PATCH ${CMAKE_MATCH_3})
|
||||
math(EXPR _version_int "(${CMAKE_MATCH_1} << 16) + (${CMAKE_MATCH_2} << 8) + ${CMAKE_MATCH_3}")
|
||||
math(EXPR _version_int
|
||||
"(${CMAKE_MATCH_1} << 16) + (${CMAKE_MATCH_2} << 8) + ${CMAKE_MATCH_3}")
|
||||
set_property(GLOBAL PROPERTY VERSION_INT ${_version_int})
|
||||
set_property(GLOBAL PROPERTY VERSION_STR "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")
|
||||
set_property(GLOBAL
|
||||
PROPERTY VERSION_STR
|
||||
"${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")
|
||||
endfunction()
|
||||
|
||||
|
@ -29,18 +29,23 @@ function(qt_translation)
|
||||
<!DOCTYPE TS>
|
||||
<TS version=\"2.1\" language=\"${_lang}\"></TS>")
|
||||
endif()
|
||||
string(APPEND L10N_QRC_BODY "<file alias=\"${_qm}\">${CMAKE_BINARY_DIR}/${_qm}</file>\n")
|
||||
string(APPEND L10N_QRC_BODY
|
||||
"<file alias=\"${_qm}\">${CMAKE_BINARY_DIR}/${_qm}</file>\n")
|
||||
|
||||
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${_qm}
|
||||
COMMAND ${Qt5_LRELEASE_EXECUTABLE} ARGS ${_ts_dir}/${_ts} -qm ${CMAKE_BINARY_DIR}/${_qm}
|
||||
COMMAND ${Qt5_LRELEASE_EXECUTABLE}
|
||||
ARGS ${_ts_dir}/${_ts} -qm
|
||||
${CMAKE_BINARY_DIR}/${_qm}
|
||||
DEPENDS ${_ts_dir}/${_ts})
|
||||
endforeach()
|
||||
|
||||
add_custom_command(OUTPUT ${_ts_list}
|
||||
COMMAND ${Qt5_LUPDATE_EXECUTABLE} ARGS ${_sources_list} -ts ${_ts_list}
|
||||
COMMAND ${Qt5_LUPDATE_EXECUTABLE}
|
||||
ARGS ${_sources_list} -ts ${_ts_list}
|
||||
DEPENDS ${_sources_list})
|
||||
|
||||
configure_file(${CMLIB_MODULE_DIR}/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)
|
||||
add_custom_target(_qrc_target DEPENDS ${_qrc})
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
if(NOT TARGET uninstall)
|
||||
configure_file(
|
||||
"${CMLIB_MODULE_DIR}/CMLibUninstall.cmake.in"
|
||||
"${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
configure_file("${CMLIB_MODULE_DIR}/CMLibUninstall.cmake.in"
|
||||
"${CMAKE_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
|
||||
|
||||
add_custom_target(uninstall
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
COMMAND ${CMAKE_COMMAND} -P
|
||||
${CMAKE_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user