Форматирование

This commit is contained in:
Andrei Astafev 2019-12-03 19:23:14 +03:00
parent 8e75846a91
commit 32dcec014f
27 changed files with 290 additions and 275 deletions

View File

@ -6,16 +6,12 @@ if(CMAKE_CONFIGURATION_TYPES)
list(APPEND CMAKE_CONFIGURATION_TYPES Profile)
endif()
else()
set(_allowed_build_types
None
Debug
Release
Profile
RelWithDebInfo
MinSizeRel)
set(_allowed_build_types None Debug Release Profile RelWithDebInfo MinSizeRel)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${_allowed_build_types})
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE)
set(CMAKE_BUILD_TYPE
Debug
CACHE STRING "" FORCE)
elseif(NOT "${CMAKE_BUILD_TYPE}" IN_LIST _allowed_build_types)
message(FATAL_ERROR "Invalid build type: ${CMAKE_BUILD_TYPE}")
endif()
@ -24,12 +20,24 @@ endif()
if(CMAKE_BUILD_TYPE STREQUAL Profile)
# Ключи компиляции для режима профилирования в зависимости от типа компилятора
if(CMAKE_CXX_COMPILER_IS_Clang OR CMAKE_CXX_COMPILER_IS_GCC)
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE} -ggdb -pg" CACHE STRING "")
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE} -ggdb -pg" CACHE STRING "")
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -pg" CACHE STRING "")
set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -pg" CACHE STRING "")
set(CMAKE_STATIC_LINKER_FLAGS_PROFILE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} -pg" CACHE STRING "")
set(CMAKE_MODULE_LINKER_FLAGS_PROFILE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -pg" CACHE STRING "")
set(CMAKE_C_FLAGS_PROFILE
"${CMAKE_C_FLAGS_RELEASE} -ggdb -pg"
CACHE STRING "")
set(CMAKE_CXX_FLAGS_PROFILE
"${CMAKE_CXX_FLAGS_RELEASE} -ggdb -pg"
CACHE STRING "")
set(CMAKE_EXE_LINKER_FLAGS_PROFILE
"${CMAKE_EXE_LINKER_FLAGS_RELEASE} -pg"
CACHE STRING "")
set(CMAKE_SHARED_LINKER_FLAGS_PROFILE
"${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -pg"
CACHE STRING "")
set(CMAKE_STATIC_LINKER_FLAGS_PROFILE
"${CMAKE_STATIC_LINKER_FLAGS_RELEASE} -pg"
CACHE STRING "")
set(CMAKE_MODULE_LINKER_FLAGS_PROFILE
"${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -pg"
CACHE STRING "")
elseif(CMAKE_CXX_COMPILER_IS_Intel)
message("Set options for profiling with Intel C++")
elseif(CMAKE_CXX_COMPILER_IS_MSVC)
@ -39,8 +47,8 @@ if(CMAKE_BUILD_TYPE STREQUAL Profile)
elseif(CMAKE_BUILD_TYPE STREQUAL Debug)
# В режиме отладки подробный вывод сообщений компилятора
if(CMAKE_CXX_COMPILER_IS_Clang OR CMAKE_CXX_COMPILER_IS_GCC)
string(APPEND CMAKE_C_FLAGS_DEBUG " -ggdb")
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -ggdb")
string(APPEND CMAKE_C_FLAGS_DEBUG " -ggdb")
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -ggdb")
endif()
set(CMAKE_VERBOSE_MAKEFILE 1)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
@ -54,5 +62,7 @@ elseif(CMAKE_BUILD_TYPE STREQUAL None)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# set(USE_CLANG_TIDY ON CACHE BOOL "Use clang-tidy")
# set(USE_CPPCHECK ON CACHE BOOL "Use cppcheck")
set(USE_PVS_STUDIO ON CACHE BOOL "Use PVS-Studio")
set(USE_PVS_STUDIO
ON
CACHE BOOL "Use PVS-Studio")
endif()

View File

@ -6,7 +6,8 @@ set(CPACK_TARGET_ARCH ${CMAKE_SYSTEM_PROCESSOR})
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(CPACK_TARGET_ARCH "amd64")
endif()
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_TARGET_ARCH}")
set(CPACK_PACKAGE_FILE_NAME
"${CMAKE_PROJECT_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_TARGET_ARCH}")
include(CPack)
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)

View File

@ -1,10 +1,5 @@
find_program(CLANG_CHECK_EXE
NAMES clang-check-10
clang-check-9
clang-check-8
clang-check-7
clang-check-6.0
clang-check)
find_program(CLANG_CHECK_EXE NAMES clang-check-10 clang-check-9 clang-check-8
clang-check-7 clang-check-6.0 clang-check)
if(CLANG_CHECK_EXE)
option(CLANG_ANALYZE_FIX "Perform fixes for Clang-Check" OFF)
endif()
@ -21,14 +16,11 @@ function(add_clang_analyze_check)
if(NOT TARGET clang-analyze-check)
add_custom_target(clang-analyze-check)
endif()
add_custom_target(clang-analyze-check-${_target}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CLANG_CHECK_EXE}
-analyze
-extra-arg="-Wno-unknown-warning-option"
-p
${CMAKE_BINARY_DIR}
${_sources})
add_custom_target(
clang-analyze-check-${_target}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CLANG_CHECK_EXE} -analyze -extra-arg="-Wno-unknown-warning-option" -p
${CMAKE_BINARY_DIR} ${_sources})
add_dependencies(clang-analyze-check-${_target} ${_target})
add_dependencies(clang-analyze-check clang-analyze-check-${_target})
else()

View File

@ -1,10 +1,5 @@
find_program(CLANG_TIDY_EXE
NAMES clang-tidy-10
clang-tidy-9
clang-tidy-8
clang-tidy-7
clang-tidy-6.0
clang-tidy)
find_program(CLANG_TIDY_EXE NAMES clang-tidy-10 clang-tidy-9 clang-tidy-8 clang-tidy-7
clang-tidy-6.0 clang-tidy)
if(CLANG_TIDY_EXE)
option(CLANG_TIDY_FIX "Perform fixes for Clang-Tidy" OFF)
if(CLANG_TIDY_FIX)
@ -21,13 +16,11 @@ function(add_clang_tidy_check)
if(NOT TARGET clang-tidy-check)
add_custom_target(clang-tidy-check)
endif()
add_custom_target(clang-tidy-check-${_target}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CLANG_TIDY_EXE}
-extra-arg="-Wno-unknown-warning-option"
-p
${CMAKE_BINARY_DIR}
${_sources})
add_custom_target(
clang-tidy-check-${_target}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CLANG_TIDY_EXE} -extra-arg="-Wno-unknown-warning-option" -p
${CMAKE_BINARY_DIR} ${_sources})
add_dependencies(clang-tidy-check-${_target} ${_target})
add_dependencies(clang-tidy-check clang-tidy-check-${_target})
else()

View File

@ -1,4 +1,6 @@
set(clazy_checks container-inside-loop,heap-allocated-small-trivial-type,inefficient-qlist,isempty-vs-count,qt-keywords,unneeded-cast)
set(clazy_checks
container-inside-loop,heap-allocated-small-trivial-type,inefficient-qlist,isempty-vs-count,qt-keywords,unneeded-cast
)
function(add_clazy_check)
list(GET ARGN 0 _target)
@ -10,14 +12,11 @@ function(add_clazy_check)
if(NOT TARGET clazy-check)
add_custom_target(clazy-check)
endif()
add_custom_target(clazy-check-${_target}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CLAZY_EXE}
-checks=level2,${clazy_checks}
-extra-arg="-Wno-unknown-warning-option"
-p
${CMAKE_BINARY_DIR}
${_sources})
add_custom_target(
clazy-check-${_target}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CLAZY_EXE} -checks=level2,${clazy_checks}
-extra-arg="-Wno-unknown-warning-option" -p ${CMAKE_BINARY_DIR} ${_sources})
add_dependencies(clazy-check-${_target} ${_target})
add_dependencies(clazy-check clazy-check-${_target})
else()

View File

@ -8,16 +8,15 @@ function(add_pvs_check)
if(NOT TARGET pvs-check)
add_custom_target(pvs-check)
endif()
pvs_studio_add_target(TARGET pvs-check-${_target}
DEPENDS ${_target}
COMPILE_COMMANDS HIDE_HELP OUTPUT
FORMAT errorfile
CONFIG "${CMAKE_BINARY_DIR}/PVS-Studio-${_target}.cfg"
ARGS --analysis-mode
29
--exclude-path
${CMAKE_CURRENT_BINARY_DIR}/${_target}_autogen
MODE GA:1,2,3;64:1;OP:1,2;CS:1,2)
pvs_studio_add_target(
TARGET pvs-check-${_target}
DEPENDS ${_target}
COMPILE_COMMANDS HIDE_HELP OUTPUT
FORMAT errorfile
CONFIG "${CMAKE_BINARY_DIR}/PVS-Studio-${_target}.cfg"
ARGS --analysis-mode 29 --exclude-path
${CMAKE_CURRENT_BINARY_DIR}/${_target}_autogen
MODE GA:1,2,3;64:1;OP:1,2;CS:1,2)
add_dependencies(pvs-check pvs-check-${_target})
else()
message(STATUS "CMLIB warning:")
@ -26,6 +25,7 @@ function(add_pvs_check)
else()
message(STATUS "CMLIB warning:")
message(
STATUS " Option CMAKE_EXPORT_COMPILE_COMMANDS is not set. PVS checks will be disabled.")
STATUS
" Option CMAKE_EXPORT_COMPILE_COMMANDS is not set. PVS checks will be disabled.")
endif()
endfunction()

View File

@ -13,25 +13,20 @@ function(add_code_coverage)
set_target_properties(${_target} PROPERTIES LINK_FLAGS ${LF})
if(LCOV_EXE)
add_custom_target(coverage-${_target}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${LCOV_EXE}
--test-name
${_target}
--output
"${_target}.lcov"
--capture
--directory
${CMAKE_BINARY_DIR})
add_custom_target(
coverage-${_target}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND
${LCOV_EXE} --test-name ${_target} --output "${_target}.lcov" --capture
--directory ${CMAKE_BINARY_DIR})
add_dependencies(coverage-${_target} ${_target})
if(GENHTML_EXE)
add_custom_target(coverage-report-${_target}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${GENHTML_EXE}
--output-directory
"report-${_target}"
"${_target}.lcov")
add_custom_target(
coverage-report-${_target}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${GENHTML_EXE} --output-directory "report-${_target}"
"${_target}.lcov")
add_dependencies(coverage-report-${_target} coverage-${_target})
endif()
endif()

View File

@ -4,11 +4,7 @@ function(add_common_library)
set(oneValueArgs TARGET OUTPUT_NAME)
set(multiValueArgs SOURCES)
cmake_parse_arguments(_LOCAL
"${options}"
"${oneValueArgs}"
"${multiValueArgs}"
${ARGN})
cmake_parse_arguments(_LOCAL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(LIBNAME ${_LOCAL_TARGET})
set(SOURCES ${_LOCAL_SOURCES})
@ -19,36 +15,39 @@ function(add_common_library)
endif()
add_library(${LIBNAME} OBJECT ${SOURCES})
target_include_directories(${LIBNAME}
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include/${LIBNAME}>)
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)
if(BUILD_SHARED_LIBS)
add_library(${LIBNAME}_shared SHARED $<TARGET_OBJECTS:${LIBNAME}>)
set_target_properties(${LIBNAME}_shared
PROPERTIES VERSION
${PROJECT_VERSION}
SOVERSION
${PROJECT_VERSION_MAJOR}
OUTPUT_NAME
${OUTNAME}
LIBRARY_OUTPUT_DIRECTORY
${CMAKE_INSTALL_LIBDIR})
set_target_properties(
${LIBNAME}_shared
PROPERTIES
VERSION
${PROJECT_VERSION}
SOVERSION
${PROJECT_VERSION_MAJOR}
OUTPUT_NAME
${OUTNAME}
LIBRARY_OUTPUT_DIRECTORY
${CMAKE_INSTALL_LIBDIR})
install(TARGETS ${LIBNAME}_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
if(NOT SKIP_STATIC_LIBS)
add_library(${LIBNAME}_static STATIC $<TARGET_OBJECTS:${LIBNAME}>)
set_target_properties(${LIBNAME}_static
PROPERTIES OUTPUT_NAME
${OUTNAME}
ARCHIVE_OUTPUT_DIRECTORY
${CMAKE_INSTALL_LIBDIR})
set_target_properties(
${LIBNAME}_static PROPERTIES OUTPUT_NAME ${OUTNAME} ARCHIVE_OUTPUT_DIRECTORY
${CMAKE_INSTALL_LIBDIR})
install(TARGETS ${LIBNAME}_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
configure_file(${CMLIB_MODULE_DIR}/pc/lib.pc.in ${CMAKE_BINARY_DIR}/${LIBNAME}.pc)
install(FILES ${CMAKE_BINARY_DIR}/${LIBNAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(FILES ${CMAKE_BINARY_DIR}/${LIBNAME}.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endfunction()

View File

@ -12,11 +12,12 @@ function(common_target_properties Name)
if(_targetType STREQUAL "EXECUTABLE" AND CMAKE_CXX_COMPILE_OPTIONS_PIE)
target_compile_options(${Name} PUBLIC "${CMAKE_CXX_COMPILE_OPTIONS_PIE}")
endif()
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>)
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>)
if(APPLE)
target_compile_definitions(${Name} ${__visibility} Darwin)
endif()
@ -25,11 +26,7 @@ function(common_target_properties Name)
if(_targetType STREQUAL "EXECUTABLE")
target_compile_options(${Name} PUBLIC "${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
endif()
set_target_properties(${Name}
PROPERTIES AUTOMOC
TRUE
AUTORCC
TRUE)
set_target_properties(${Name} PROPERTIES AUTOMOC TRUE AUTORCC TRUE)
endif()
if(TARGET Qt5::Widgets)
set_target_properties(${Name} PROPERTIES AUTOUIC TRUE)
@ -52,19 +49,24 @@ function(common_target_properties Name)
check_cxx_compiler_flag(-flto CXX_HAS_LTO_FLAG)
check_cxx_compiler_flag(-fno-fat-lto-objects CXX_HAS_NO_FAT_LTO_FLAG)
if(CMAKE_CXX_COMPILER_IS_GCC AND CXX_HAS_LTO_FLAG)
find_program(CMAKE_GCC_AR
NAMES "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar${_CMAKE_TOOLCHAIN_SUFFIX}"
"${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar"
HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
find_program(CMAKE_GCC_NM
NAMES "${_CMAKE_TOOLCHAIN_PREFIX}gcc-nm${_CMAKE_TOOLCHAIN_SUFFIX}"
"${_CMAKE_TOOLCHAIN_PREFIX}gcc-nm"
HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
find_program(CMAKE_GCC_RANLIB
NAMES "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib${_CMAKE_TOOLCHAIN_SUFFIX}"
"${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib"
HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
if(CMAKE_GCC_AR AND CMAKE_GCC_NM AND CMAKE_GCC_RANLIB)
find_program(
CMAKE_GCC_AR
NAMES "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar${_CMAKE_TOOLCHAIN_SUFFIX}"
"${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar"
HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
find_program(
CMAKE_GCC_NM
NAMES "${_CMAKE_TOOLCHAIN_PREFIX}gcc-nm${_CMAKE_TOOLCHAIN_SUFFIX}"
"${_CMAKE_TOOLCHAIN_PREFIX}gcc-nm"
HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
find_program(
CMAKE_GCC_RANLIB
NAMES "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib${_CMAKE_TOOLCHAIN_SUFFIX}"
"${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib"
HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
if(CMAKE_GCC_AR
AND CMAKE_GCC_NM
AND CMAKE_GCC_RANLIB)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto")
if(CXX_HAS_NO_FAT_LTO_FLAG)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-fat-lto-objects")
@ -75,7 +77,8 @@ function(common_target_properties Name)
else()
message(
WARNING
"GCC indicates LTO support, but binutils wrappers could not be found. Disabling LTO.")
"GCC indicates LTO support, but binutils wrappers could not be found. Disabling LTO."
)
endif()
else()
check_enable_compiler_flag(-flto)

View File

@ -12,7 +12,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)

View File

@ -1,17 +1,16 @@
include(WriteCompilerDetectionHeader)
write_compiler_detection_header(FILE include/compiler_features.hpp
PREFIX ${CMLIB_PROJECT_NAME_CANONICAL}
COMPILERS GNU
Clang
MSVC
Intel
FEATURES cxx_nullptr
cxx_override
cxx_alignas
cxx_alignof
cxx_attributes
cxx_auto_type
cxx_constexpr
cxx_digit_separators
cxx_range_for)
write_compiler_detection_header(
FILE include/compiler_features.hpp
PREFIX ${CMLIB_PROJECT_NAME_CANONICAL}
COMPILERS GNU Clang MSVC Intel
FEATURES
cxx_nullptr
cxx_override
cxx_alignas
cxx_alignof
cxx_attributes
cxx_auto_type
cxx_constexpr
cxx_digit_separators
cxx_range_for)

View File

@ -31,7 +31,9 @@ else()
endif()
# 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)

View File

@ -13,15 +13,19 @@ if(${_source_realpath} STREQUAL ${_binary_realpath})
endif()
# Очистка от сгенерированных файлов
file(GLOB_RECURSE _cmakelists_files RELATIVE ${_source_realpath} CMakeLists.txt)
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
${_dir}/CMakeCache.txt
${_dir}/cmake_install.cmake
${_dir}/Makefile
${_dir}/build.ninja
${_dir}/rules.ninja)
file(
REMOVE_RECURSE
${_dir}/CMakeFiles
${_dir}/CMakeCache.txt
${_dir}/cmake_install.cmake
${_dir}/Makefile
${_dir}/build.ninja
${_dir}/rules.ninja)
endforeach()

View File

@ -2,10 +2,12 @@ find_program(DISTCC_EXECUTABLE distcc)
mark_as_advanced(DISTCC_EXECUTABLE)
if(DISTCC_EXECUTABLE)
foreach(LANG C CXX)
if(NOT DEFINED CMAKE_${LANG}_COMPILER_LAUNCHER
AND NOT CMAKE_${LANG}_COMPILER MATCHES ".*/distcc$")
if(NOT DEFINED CMAKE_${LANG}_COMPILER_LAUNCHER AND NOT CMAKE_${LANG}_COMPILER MATCHES
".*/distcc$")
message(STATUS "Enabling distcc for ${LANG}")
set(CMAKE_${LANG}_COMPILER_LAUNCHER ${DISTCC_EXECUTABLE} CACHE STRING "")
set(CMAKE_${LANG}_COMPILER_LAUNCHER
${DISTCC_EXECUTABLE}
CACHE STRING "")
endif()
endforeach()
endif()

View File

@ -37,7 +37,8 @@ function(add_breathe_target)
set(oneValueArgs TARGET_NAME COMMENT)
set(multiValueArgs)
cmake_parse_arguments(_BREATHE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
cmake_parse_arguments(_BREATHE "${options}" "${oneValueArgs}" "${multiValueArgs}"
${ARGN})
if(BREATHE_FOUND)
set(WORK_DIR ${CMAKE_BINARY_DIR}/_breathe)
set(BREATHE_DOCS_BUILD_DIR ${WORK_DIR})
@ -63,8 +64,9 @@ function(add_breathe_target)
configure_file(${INDEX_MD_FILE} ${WORK_DIR}/index.md @ONLY)
file(GLOB MD_FILES ${CMAKE_SOURCE_DIR}/doc/breathe/*.md)
if(MD_FILES)
add_custom_command(TARGET ${_BREATHE_TARGET_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MD_FILES} ${WORK_DIR})
add_custom_command(
TARGET ${_BREATHE_TARGET_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MD_FILES} ${WORK_DIR})
endif()
endif()
@ -73,12 +75,14 @@ function(add_breathe_target)
configure_file(${INDEX_RST_FILE} ${WORK_DIR}/index.rst @ONLY)
file(GLOB RST_FILES ${CMAKE_SOURCE_DIR}/doc/breathe/*.rst)
if(RST_FILES)
add_custom_command(TARGET ${_BREATHE_TARGET_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${RST_FILES} ${WORK_DIR})
add_custom_command(
TARGET ${_BREATHE_TARGET_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${RST_FILES} ${WORK_DIR})
endif()
endif()
else()
add_custom_target(${_BREATHE_TARGET_NAME} VERBATIM
COMMENT "Breathe is not found. Skipping target ${_BREATHE_TARGET_NAME} build")
add_custom_target(
${_BREATHE_TARGET_NAME} VERBATIM
COMMENT "Breathe is not found. Skipping target ${_BREATHE_TARGET_NAME} build")
endif()
endfunction()

View File

@ -19,7 +19,8 @@ function(add_doxygen_target)
set(oneValueArgs TARGET_NAME SQLITE LATEX HTML)
set(multiValueArgs)
cmake_parse_arguments(_DOXYGEN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
cmake_parse_arguments(_DOXYGEN "${options}" "${oneValueArgs}" "${multiValueArgs}"
${ARGN})
if(DOXYGEN_FOUND)
set(GENERATE_XML NO)
set(GENERATE_HTML NO)
@ -45,7 +46,8 @@ function(add_doxygen_target)
WORKING_DIRECTORY ${WORK_DIR}
COMMENT "Generating API documentation with Doxygen")
else()
add_custom_target(${_DOXYGEN_TARGET_NAME} VERBATIM
COMMENT "Doxygen is not found. Skipping target ${_DOXYGEN_TARGET_NAME} build")
add_custom_target(
${_DOXYGEN_TARGET_NAME} VERBATIM
COMMENT "Doxygen is not found. Skipping target ${_DOXYGEN_TARGET_NAME} build")
endif()
endfunction()

View File

@ -22,10 +22,7 @@ endmacro()
#
# Pre: apply_global_cxx_flags_to_all_targets() must be invoked.
#
macro(remove_flag_from_file
_target
_file
_flag)
macro(remove_flag_from_file _target _file _flag)
get_target_property(_target_sources ${_target} SOURCES)
# Check if a sync is required, in which case we'll force a rewrite of the cache variables.
if(_flag_sync_required)
@ -38,7 +35,9 @@ macro(remove_flag_from_file
if(NOT _cached_${_target}_cxx_flags)
# Obtain and cache the target compiler options, then clear them.
get_target_property(_target_cxx_flags ${_target} COMPILE_OPTIONS)
set(_cached_${_target}_cxx_flags "${_target_cxx_flags}" CACHE INTERNAL "")
set(_cached_${_target}_cxx_flags
"${_target_cxx_flags}"
CACHE INTERNAL "")
set_target_properties(${_target} PROPERTIES COMPILE_OPTIONS "")
# Apply the target compile flags to each source file.
foreach(_source_file ${_target_sources})
@ -51,13 +50,8 @@ macro(remove_flag_from_file
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
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()
@ -68,17 +62,15 @@ macro(remove_flag_from_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 "")
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
string(REPLACE ";" " " _cached_${_target}_${_file}_cxx_flags_string
"${_cached_${_target}_${_file}_cxx_flags}")
set_source_files_properties(${_file}
PROPERTIES
COMPILE_FLAGS
set_source_files_properties(${_file} PROPERTIES COMPILE_FLAGS
"${_cached_${_target}_${_file}_cxx_flags_string}")
endif()
endmacro()

View File

@ -9,14 +9,12 @@ function(add_format_sources)
find_program(UNCRUSTIFY_EXE NAMES uncrustify)
if(UNCRUSTIFY_EXE)
list(APPEND UNCRUSTIFY_OPTS
-lCPP
--replace
--no-backup)
list(APPEND UNCRUSTIFY_OPTS -lCPP --replace --no-backup)
if(EXISTS ${CMAKE_SOURCE_DIR}/cmake/etc/uncrustify/default.cfg)
list(APPEND UNCRUSTIFY_OPTS -c ${CMAKE_SOURCE_DIR}/cmake/etc/uncrustify/default.cfg)
endif()
add_custom_target(format-sources-uncrustify-${_target} COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS} ${_sources})
add_custom_target(format-sources-uncrustify-${_target}
COMMAND ${UNCRUSTIFY_EXE} ${UNCRUSTIFY_OPTS} ${_sources})
add_dependencies(format-sources format-sources-uncrustify-${_target})
else()
message(STATUS "CMLIB warning:")
@ -25,10 +23,9 @@ function(add_format_sources)
find_program(DOS2UNIX_EXE NAMES dos2unix)
if(DOS2UNIX_EXE)
list(APPEND DOS2UNIX_OPTS
-k
-r)
add_custom_target(format-sources-dos2unix-${_target} COMMAND ${DOS2UNIX_EXE} ${OPTS} ${_sources})
list(APPEND DOS2UNIX_OPTS -k -r)
add_custom_target(format-sources-dos2unix-${_target} COMMAND ${DOS2UNIX_EXE} ${OPTS}
${_sources})
add_dependencies(format-sources format-sources-dos2unix-${_target})
else()
message(STATUS "CMLIB warning:")

View File

@ -1,10 +1,6 @@
# CMLIB_PROJECT_NAME_CANONICAL
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})
# CMLIB_MODULE_DIR

View File

@ -13,22 +13,26 @@ set(LSB_RELEASE "unknown")
if(EXISTS /etc/mcst_version)
set(LSB_DISTRIBUTOR_ID "ElbrusD")
set(LSB_CODENAME "Jessie")
execute_process(COMMAND cat /etc/mcst_version
OUTPUT_VARIABLE LSB_RELEASE
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND cat /etc/mcst_version
OUTPUT_VARIABLE LSB_RELEASE
OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
find_program(_lsb_release_executable lsb_release)
if(_lsb_release_executable)
execute_process(COMMAND ${_lsb_release_executable} -si
OUTPUT_VARIABLE LSB_DISTRIBUTOR_ID
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND ${_lsb_release_executable} -si
OUTPUT_VARIABLE LSB_DISTRIBUTOR_ID
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${_lsb_release_executable} -sc
OUTPUT_VARIABLE LSB_CODENAME
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND ${_lsb_release_executable} -sc
OUTPUT_VARIABLE LSB_CODENAME
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${_lsb_release_executable} -sr
OUTPUT_VARIABLE LSB_RELEASE
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND ${_lsb_release_executable} -sr
OUTPUT_VARIABLE LSB_RELEASE
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
endif()

View File

@ -61,38 +61,48 @@ macro(cmlib_test_large_files VARIABLE)
message(STATUS "Checking for 64-bit off_t")
# First check without any special flags
try_compile(FILE64_OK "${CMAKE_BINARY_DIR}" "${CMLIB_MODULE_DIR}/tests/TestFileOffsetBits.c")
try_compile(FILE64_OK "${CMAKE_BINARY_DIR}"
"${CMLIB_MODULE_DIR}/tests/TestFileOffsetBits.c")
if(FILE64_OK)
message(STATUS "Checking for 64-bit off_t - present")
endif()
if(NOT FILE64_OK)
# Test with _FILE_OFFSET_BITS=64
try_compile(FILE64_OK "${CMAKE_BINARY_DIR}" "${CMLIB_MODULE_DIR}/tests/TestFileOffsetBits.c"
COMPILE_DEFINITIONS "-D_FILE_OFFSET_BITS=64")
try_compile(
FILE64_OK "${CMAKE_BINARY_DIR}" "${CMLIB_MODULE_DIR}/tests/TestFileOffsetBits.c"
COMPILE_DEFINITIONS "-D_FILE_OFFSET_BITS=64")
if(FILE64_OK)
message(STATUS "Checking for 64-bit off_t - present with _FILE_OFFSET_BITS=64")
set(_FILE_OFFSET_BITS 64 CACHE INTERNAL "64-bit off_t requires _FILE_OFFSET_BITS=64")
set(_FILE_OFFSET_BITS
64
CACHE INTERNAL "64-bit off_t requires _FILE_OFFSET_BITS=64")
endif()
endif()
if(NOT FILE64_OK)
# Test with _LARGE_FILES
try_compile(FILE64_OK "${CMAKE_BINARY_DIR}" "${CMLIB_MODULE_DIR}/tests/TestFileOffsetBits.c"
COMPILE_DEFINITIONS "-D_LARGE_FILES")
try_compile(
FILE64_OK "${CMAKE_BINARY_DIR}" "${CMLIB_MODULE_DIR}/tests/TestFileOffsetBits.c"
COMPILE_DEFINITIONS "-D_LARGE_FILES")
if(FILE64_OK)
message(STATUS "Checking for 64-bit off_t - present with _LARGE_FILES")
set(_LARGE_FILES 1 CACHE INTERNAL "64-bit off_t requires _LARGE_FILES")
set(_LARGE_FILES
1
CACHE INTERNAL "64-bit off_t requires _LARGE_FILES")
endif()
endif()
if(NOT FILE64_OK)
# Test with _LARGEFILE_SOURCE
try_compile(FILE64_OK "${CMAKE_BINARY_DIR}" "${CMLIB_MODULE_DIR}/tests/TestFileOffsetBits.c"
COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE")
try_compile(
FILE64_OK "${CMAKE_BINARY_DIR}" "${CMLIB_MODULE_DIR}/tests/TestFileOffsetBits.c"
COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE")
if(FILE64_OK)
message(STATUS "Checking for 64-bit off_t - present with _LARGEFILE_SOURCE")
set(_LARGEFILE_SOURCE 1 CACHE INTERNAL "64-bit off_t requires _LARGEFILE_SOURCE")
set(_LARGEFILE_SOURCE
1
CACHE INTERNAL "64-bit off_t requires _LARGEFILE_SOURCE")
endif()
endif()
@ -115,12 +125,15 @@ macro(cmlib_test_large_files VARIABLE)
if(NOT FSEEKO_COMPILE_OK)
# glibc 2.2 neds _LARGEFILE_SOURCE for fseeko (but not 64-bit off_t...)
try_compile(FSEEKO_COMPILE_OK "${CMAKE_BINARY_DIR}"
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestLargeFiles.c"
COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE")
try_compile(
FSEEKO_COMPILE_OK "${CMAKE_BINARY_DIR}"
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestLargeFiles.c"
COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE")
if(FSEEKO_COMPILE_OK)
message(STATUS "Checking for fseeko/ftello - present with _LARGEFILE_SOURCE")
set(_LARGEFILE_SOURCE 1 CACHE INTERNAL "64-bit fseeko requires _LARGEFILE_SOURCE")
set(_LARGEFILE_SOURCE
1
CACHE INTERNAL "64-bit fseeko requires _LARGEFILE_SOURCE")
else()
set(FILE64_OK 0)
message(STATUS "64-bit off_t present but fseeko/ftello not found!")
@ -130,23 +143,36 @@ macro(cmlib_test_large_files VARIABLE)
if(NOT FILE64_OK)
# now check for Windows stuff
try_compile(FILE64_OK "${CMAKE_BINARY_DIR}" "${CMLIB_MODULE_DIR}/tests/TestWindowsFSeek.c")
try_compile(FILE64_OK "${CMAKE_BINARY_DIR}"
"${CMLIB_MODULE_DIR}/tests/TestWindowsFSeek.c")
if(FILE64_OK)
message(STATUS "Checking for 64-bit off_t - present with _fseeki64")
set(HAVE__FSEEKI64 1 CACHE INTERNAL "64-bit off_t requires _fseeki64")
set(HAVE__FSEEKI64
1
CACHE INTERNAL "64-bit off_t requires _fseeki64")
endif()
endif()
if(FSEEKO_COMPILE_OK)
set(${VARIABLE} 1 CACHE INTERNAL "Result of test for large file support" FORCE)
set(HAVE_FSEEKO 1 CACHE INTERNAL "64bit fseeko is available" FORCE)
set(${VARIABLE}
1
CACHE INTERNAL "Result of test for large file support" FORCE)
set(HAVE_FSEEKO
1
CACHE INTERNAL "64bit fseeko is available" FORCE)
elseif(HAVE__FSEEKI64)
set(${VARIABLE} 1 CACHE INTERNAL "Result of test for large file support" FORCE)
set(HAVE__FSEEKI64 1 CACHE INTERNAL "Windows 64-bit fseek" FORCE)
set(${VARIABLE}
1
CACHE INTERNAL "Result of test for large file support" FORCE)
set(HAVE__FSEEKI64
1
CACHE INTERNAL "Windows 64-bit fseek" FORCE)
else()
check_type_size("long int" SIZEOF_LONG_INT)
if(SIZEOF_LONG_INT EQUAL 8) #standard fseek is OK for 64bit
set(${VARIABLE} 1 CACHE INTERNAL "Result of test for large file support" FORCE)
set(${VARIABLE}
1
CACHE INTERNAL "Result of test for large file support" FORCE)
else()
message(FATAL_ERROR "Checking for 64bit file support failed.")
endif()

View File

@ -6,16 +6,16 @@ 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")
endif()
string(REGEX MATCH
"^([0-9A-Za-z ,.]+)\n"
_
${_org})
string(REGEX MATCH "^([0-9A-Za-z ,.]+)\n" _ ${_org})
set_property(GLOBAL PROPERTY ORGANIZATION_NAME ${CMAKE_MATCH_1})
endfunction()

View File

@ -4,7 +4,9 @@ function(set_project_version)
endif()
math(
EXPR _version_int
"(${PROJECT_VERSION_MAJOR} << 16) + (${PROJECT_VERSION_MINOR} << 8) + ${PROJECT_VERSION_PATCH}")
EXPR
_version_int
"(${PROJECT_VERSION_MAJOR} << 16) + (${PROJECT_VERSION_MINOR} << 8) + ${PROJECT_VERSION_PATCH}"
)
set_property(GLOBAL PROPERTY PROJECT_VERSION_INT ${_version_int})
endfunction()

View File

@ -1,15 +1,14 @@
function(qt_translation)
find_package(Qt5 COMPONENTS LinguistTools REQUIRED)
find_package(
Qt5
COMPONENTS LinguistTools
REQUIRED)
set(options)
set(oneValueArgs TARGET TS_DIR)
set(multiValueArgs LANGUAGES)
cmake_parse_arguments(_QTTR
"${options}"
"${oneValueArgs}"
"${multiValueArgs}"
${ARGN})
cmake_parse_arguments(_QTTR "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(_target ${_QTTR_TARGET})
set(_ts_dir ${_QTTR_TS_DIR})
set(_languages ${_QTTR_LANGUAGES})
@ -23,16 +22,14 @@ function(qt_translation)
set(_qm "${_target}_${_lang}.qm")
list(APPEND _ts_list ${_ts_dir}/${_ts})
list(APPEND _l10n_targets "${_target}_l10n_${_lang}")
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_target(${_target}_l10n_${_lang}
COMMAND ${Qt5_LUPDATE_EXECUTABLE}
${_sources}
-ts
${_ts_dir}/${_ts}
-target-language
${_lang}
DEPENDS ${_sources})
add_custom_target(
${_target}_l10n_${_lang}
COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${_sources} -ts ${_ts_dir}/${_ts} -target-language
${_lang}
DEPENDS ${_sources})
if(NOT EXISTS "${_ts_dir}/${_ts}")
add_custom_target(${_ts} DEPENDS ${_target}_l10n_${_lang})
@ -40,16 +37,15 @@ function(qt_translation)
add_custom_target(${_ts} COMMAND echo "Skipping lupdate for ${_ts}")
endif()
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${_qm}
COMMAND ${Qt5_LRELEASE_EXECUTABLE}
ARGS
${_ts_dir}/${_ts}
-qm
${CMAKE_BINARY_DIR}/${_qm}
DEPENDS ${_ts} ${_sources})
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/${_qm}
COMMAND ${Qt5_LRELEASE_EXECUTABLE} ARGS ${_ts_dir}/${_ts} -qm
${CMAKE_BINARY_DIR}/${_qm}
DEPENDS ${_ts} ${_sources})
endforeach()
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(${_target}_qrc DEPENDS ${_qrc})
add_custom_target(${_target}_l10n DEPENDS ${_l10n_targets})

View File

@ -19,7 +19,8 @@ if(NOT CPACK_PACKAGE_CONTACT)
endif()
if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
message(FATAL_ERROR "Required variable CPACK_PACKAGE_DESCRIPTION_SUMMARY is not defined")
message(
FATAL_ERROR "Required variable CPACK_PACKAGE_DESCRIPTION_SUMMARY is not defined")
endif()
if(NOT CPACK_DEBIAN_PACKAGE_SECTION)

View File

@ -4,9 +4,5 @@ if(NOT TODAY)
else()
execute_process(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE TODAY)
endif()
string(REGEX
REPLACE "(..)/(..)/(....).*"
"\\3-\\2-\\1"
TODAY
${TODAY})
string(REGEX REPLACE "(..)/(..)/(....).*" "\\3-\\2-\\1" TODAY ${TODAY})
endif()

View File

@ -1,8 +1,7 @@
if(NOT TARGET uninstall)
configure_file("${CMLIB_MODULE_DIR}/CMLibUninstall.cmake.in"
"${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE
@ONLY)
"${CMAKE_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake)
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P
${CMAKE_BINARY_DIR}/cmake_uninstall.cmake)
endif()