Allow disabling install targets
Might be useful if install targets cause problems, eg. under MacOS
This commit is contained in:
parent
326551ee02
commit
36b2498dd6
|
@ -65,7 +65,7 @@ set_target_properties(${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX} PROPE
|
||||||
AUTOGEN_TARGET_DEPENDS "${AUTOGEN_DEPS}"
|
AUTOGEN_TARGET_DEPENDS "${AUTOGEN_DEPS}"
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT META_NO_INSTALL_TARGETS)
|
if(NOT META_NO_INSTALL_TARGETS AND ENABLE_INSTALL_TARGETS)
|
||||||
# add install target for binary
|
# add install target for binary
|
||||||
install(TARGETS ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}
|
install(TARGETS ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
|
|
|
@ -252,19 +252,29 @@ if(CLANG_SOURCE_BASED_COVERAGE_ENABLED)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# configure creation of install targets
|
||||||
|
if(NOT META_NO_INSTALL_TARGETS)
|
||||||
|
# install targets have not been disabled on project level
|
||||||
|
# check whether install targets are disabled by the user
|
||||||
|
# this might be useful since install targets seem to cause problems under MacOS
|
||||||
|
option(ENABLE_INSTALL_TARGETS "enables creation of install targets" ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
# add install target for extra files
|
# add install target for extra files
|
||||||
foreach(EXTRA_FILE ${EXTRA_FILES})
|
if(NOT META_NO_INSTALL_TARGETS AND ENABLE_INSTALL_TARGETS)
|
||||||
get_filename_component(EXTRA_DIR ${EXTRA_FILE} DIRECTORY)
|
foreach(EXTRA_FILE ${EXTRA_FILES})
|
||||||
install(
|
get_filename_component(EXTRA_DIR ${EXTRA_FILE} DIRECTORY)
|
||||||
FILES ${EXTRA_FILE}
|
install(
|
||||||
DESTINATION "share/${META_PROJECT_NAME}/${EXTRA_DIR}"
|
FILES ${EXTRA_FILE}
|
||||||
COMPONENT extra-files
|
DESTINATION "share/${META_PROJECT_NAME}/${EXTRA_DIR}"
|
||||||
)
|
COMPONENT extra-files
|
||||||
endforeach()
|
)
|
||||||
if(NOT TARGET install-extra-files)
|
endforeach()
|
||||||
add_custom_target(install-extra-files
|
if(NOT TARGET install-extra-files)
|
||||||
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=extra-files -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
add_custom_target(install-extra-files
|
||||||
)
|
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=extra-files -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(BASIC_PROJECT_CONFIG_DONE YES)
|
set(BASIC_PROJECT_CONFIG_DONE YES)
|
||||||
|
|
|
@ -61,15 +61,17 @@ if(NOT NO_DOXYGEN)
|
||||||
add_dependencies(apidoc "${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_apidoc")
|
add_dependencies(apidoc "${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_apidoc")
|
||||||
|
|
||||||
# add install target for API documentation
|
# add install target for API documentation
|
||||||
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/api-doc"
|
if(NOT META_NO_INSTALL_TARGETS AND ENABLE_INSTALL_TARGETS)
|
||||||
DESTINATION "share/${META_PROJECT_NAME}"
|
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/api-doc"
|
||||||
COMPONENT api-doc
|
DESTINATION "share/${META_PROJECT_NAME}"
|
||||||
OPTIONAL
|
COMPONENT api-doc
|
||||||
)
|
OPTIONAL
|
||||||
if(NOT TARGET install-api-doc)
|
|
||||||
add_custom_target(install-api-doc
|
|
||||||
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=api-doc -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
|
||||||
)
|
)
|
||||||
|
if(NOT TARGET install-api-doc)
|
||||||
|
add_custom_target(install-api-doc
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=api-doc -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "Generating target for generating API documentation for ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX} with Doxygen")
|
message(STATUS "Generating target for generating API documentation for ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX} with Doxygen")
|
||||||
|
|
|
@ -305,7 +305,7 @@ configure_file(
|
||||||
)
|
)
|
||||||
list(APPEND PC_FILES "${CMAKE_CURRENT_BINARY_DIR}/${META_PROJECT_NAME_FOR_PC}.pc")
|
list(APPEND PC_FILES "${CMAKE_CURRENT_BINARY_DIR}/${META_PROJECT_NAME_FOR_PC}.pc")
|
||||||
|
|
||||||
if(NOT META_NO_INSTALL_TARGETS)
|
if(NOT META_NO_INSTALL_TARGETS AND ENABLE_INSTALL_TARGETS)
|
||||||
# add install target for the CMake config files
|
# add install target for the CMake config files
|
||||||
install(
|
install(
|
||||||
FILES
|
FILES
|
||||||
|
|
|
@ -20,14 +20,16 @@ if(SHELL_COMPLETION_ENABLED)
|
||||||
)
|
)
|
||||||
|
|
||||||
# add install target bash completion
|
# add install target bash completion
|
||||||
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bash-completion/completions"
|
if(NOT META_NO_INSTALL_TARGETS AND ENABLE_INSTALL_TARGETS)
|
||||||
DESTINATION "share/bash-completion"
|
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bash-completion/completions"
|
||||||
COMPONENT bash-completion
|
DESTINATION "share/bash-completion"
|
||||||
)
|
COMPONENT bash-completion
|
||||||
if(NOT TARGET install-bash-completion)
|
|
||||||
add_custom_target(install-bash-completion
|
|
||||||
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=bash-completion -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
|
||||||
)
|
)
|
||||||
|
if(NOT TARGET install-bash-completion)
|
||||||
|
add_custom_target(install-bash-completion
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=bash-completion -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "Generating files for bash completion.")
|
message(STATUS "Generating files for bash completion.")
|
||||||
|
|
Loading…
Reference in New Issue