summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-08-26 11:50:08 -0400
committerBrad King <brad.king@kitware.com>2013-08-26 11:54:07 -0400
commitdf62f64db72b6f00657e9e739e1e117639dea9da (patch)
tree88a64dd1f0579ab27b18b0911c817c1e556b3259
parent8da09f6ee1a59cbef6327d2a88ab8ba5f8b29b1a (diff)
downloadcmake-df62f64db72b6f00657e9e739e1e117639dea9da.tar.gz
Clean up install rules of CMake itself (#14371)
Ensure CMAKE_DATA_DIR, CMAKE_DOC_DIR, and CMAKE_MAN_DIR are always relative paths in CMake code, and set defaults accordingly. Use the install() command instead of install_files() and install_targets(). This is more modern and also avoids stripping of the first character from user-specified destinations. While at it, fix the default destinations reported in the bootstrap help.
-rw-r--r--CMakeLists.txt23
-rw-r--r--Docs/CMakeLists.txt5
-rw-r--r--Docs/bash-completion/CMakeLists.txt2
-rw-r--r--Source/CMakeLists.txt12
-rw-r--r--Source/CursesDialog/CMakeLists.txt2
-rw-r--r--Source/cmConfigure.cmake.h.in2
-rw-r--r--Utilities/CMakeLists.txt5
-rw-r--r--Utilities/cmcompress/CMakeLists.txt2
-rw-r--r--Utilities/cmcurl/CMakeLists.txt4
-rw-r--r--Utilities/cmexpat/CMakeLists.txt2
-rw-r--r--Utilities/cmlibarchive/CMakeLists.txt2
-rw-r--r--Utilities/cmzlib/CMakeLists.txt2
-rwxr-xr-xbootstrap20
13 files changed, 41 insertions, 42 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 75d372d03a..1fbbe08a11 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -231,7 +231,7 @@ macro (CMAKE_BUILD_UTILITIES)
set(KWSYS_USE_Process 1)
set(KWSYS_USE_CommandLineArguments 1)
set(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source)
- set(KWSYS_INSTALL_DOC_DIR "${CMake_DOC_DEST}")
+ set(KWSYS_INSTALL_DOC_DIR "${CMAKE_DOC_DIR}")
add_subdirectory(Source/kwsys)
set(kwsys_folder "Utilities/KWSys")
CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE} "${kwsys_folder}")
@@ -460,26 +460,27 @@ set(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL
# install tree.
set(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.")
-set(CMAKE_DATA_DIR "/share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}" CACHE STRING
+set(CMAKE_DATA_DIR "share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}" CACHE STRING
"Install location for data (relative to prefix).")
-set(CMAKE_DOC_DIR "/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}" CACHE STRING
+set(CMAKE_DOC_DIR "doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}" CACHE STRING
"Install location for documentation (relative to prefix).")
-set(CMAKE_MAN_DIR "/man" CACHE STRING
+set(CMAKE_MAN_DIR "man" CACHE STRING
"Install location for man pages (relative to prefix).")
mark_as_advanced(CMAKE_DATA_DIR CMAKE_DOC_DIR CMAKE_MAN_DIR)
if(CYGWIN AND EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
# Force doc, data and man dirs to conform to cygwin layout.
- set(CMAKE_DOC_DIR "/share/doc/cmake-${CMake_VERSION}")
- set(CMAKE_DATA_DIR "/share/cmake-${CMake_VERSION}")
- set(CMAKE_MAN_DIR "/share/man")
+ set(CMAKE_DOC_DIR "share/doc/cmake-${CMake_VERSION}")
+ set(CMAKE_DATA_DIR "share/cmake-${CMake_VERSION}")
+ set(CMAKE_MAN_DIR "share/man")
# let the user know we just forced these values
message(STATUS "Setup for Cygwin packaging")
message(STATUS "Override cache CMAKE_DOC_DIR = ${CMAKE_DOC_DIR}")
message(STATUS "Override cache CMAKE_DATA_DIR = ${CMAKE_DATA_DIR}")
message(STATUS "Override cache CMAKE_MAN_DIR = ${CMAKE_MAN_DIR}")
endif()
-string(REGEX REPLACE "^/" "" CMake_DATA_DEST "${CMAKE_DATA_DIR}")
-string(REGEX REPLACE "^/" "" CMake_DOC_DEST "${CMAKE_DOC_DIR}")
+string(REGEX REPLACE "^/" "" CMAKE_DATA_DIR "${CMAKE_DATA_DIR}")
+string(REGEX REPLACE "^/" "" CMAKE_DOC_DIR "${CMAKE_DOC_DIR}")
+string(REGEX REPLACE "^/" "" CMAKE_MAN_DIR "${CMAKE_MAN_DIR}")
if(BUILD_TESTING)
include(${CMake_SOURCE_DIR}/Tests/CMakeInstall.cmake)
@@ -625,12 +626,12 @@ add_test(SystemInformationNew "${CMAKE_CMAKE_COMMAND}"
--system-information -G "${CMAKE_TEST_GENERATOR}" )
# Install license file as it requires.
-install(FILES Copyright.txt DESTINATION ${CMake_DOC_DEST})
+install(FILES Copyright.txt DESTINATION ${CMAKE_DOC_DIR})
# Install script directories.
install(
DIRECTORY Modules Templates
- DESTINATION "${CMake_DATA_DEST}"
+ DESTINATION ${CMAKE_DATA_DIR}
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
DIRECTORY_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
GROUP_READ GROUP_EXECUTE
diff --git a/Docs/CMakeLists.txt b/Docs/CMakeLists.txt
index a5e91c9d1b..34090d2349 100644
--- a/Docs/CMakeLists.txt
+++ b/Docs/CMakeLists.txt
@@ -1,4 +1,3 @@
-string(REGEX REPLACE "^/(.*)" "\\1" REL_CMAKE_DATA_DIR "${CMAKE_DATA_DIR}")
-install(FILES cmake-help.vim cmake-indent.vim cmake-syntax.vim DESTINATION ${REL_CMAKE_DATA_DIR}/editors/vim)
-install(FILES cmake-mode.el DESTINATION ${REL_CMAKE_DATA_DIR}/editors/emacs)
+install(FILES cmake-help.vim cmake-indent.vim cmake-syntax.vim DESTINATION ${CMAKE_DATA_DIR}/editors/vim)
+install(FILES cmake-mode.el DESTINATION ${CMAKE_DATA_DIR}/editors/emacs)
add_subdirectory (bash-completion)
diff --git a/Docs/bash-completion/CMakeLists.txt b/Docs/bash-completion/CMakeLists.txt
index 592b71e933..c0a88999ec 100644
--- a/Docs/bash-completion/CMakeLists.txt
+++ b/Docs/bash-completion/CMakeLists.txt
@@ -5,4 +5,4 @@
# add symlinks to the files in appropriate places
# /etc/bash_completion.d/
# DATADIR/completions (may be /usr/share/<package>/completions
-install(FILES cmake cpack ctest DESTINATION ${REL_CMAKE_DATA_DIR}/completions)
+install(FILES cmake cpack ctest DESTINATION ${CMAKE_DATA_DIR}/completions)
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 64fc53f447..8412e3e86c 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -394,7 +394,7 @@ if(WIN32 AND NOT CYGWIN AND NOT BORLAND)
set_source_files_properties(cmcldeps.cxx PROPERTIES COMPILE_DEFINITIONS _WIN32_WINNT=0x0501)
add_executable(cmcldeps cmcldeps.cxx)
target_link_libraries(cmcldeps CMakeLib)
- install_targets(/bin cmcldeps)
+ install(TARGETS cmcldeps DESTINATION bin)
endif()
# create a library used by the command line and the GUI
@@ -554,7 +554,7 @@ if(WIN32)
if(NOT UNIX)
add_executable(cmw9xcom cmw9xcom.cxx)
target_link_libraries(cmw9xcom CMakeLib)
- install_targets(/bin cmw9xcom)
+ install(TARGETS cmw9xcom DESTINATION bin)
endif()
endif()
@@ -580,11 +580,9 @@ endif()
include (${CMake_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
include (${CMake_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
-install_targets(/bin cmake)
-install_targets(/bin ctest)
-install_targets(/bin cpack)
+install(TARGETS cmake ctest cpack DESTINATION bin)
if(APPLE)
- install_targets(/bin cmakexbuild)
+ install(TARGETS cmakexbuild DESTINATION bin)
endif()
-install_files(${CMAKE_DATA_DIR}/include cmCPluginAPI.h)
+install(FILES cmCPluginAPI.h DESTINATION ${CMAKE_DATA_DIR}/include)
diff --git a/Source/CursesDialog/CMakeLists.txt b/Source/CursesDialog/CMakeLists.txt
index 96e28b4919..5efc2fb1ac 100644
--- a/Source/CursesDialog/CMakeLists.txt
+++ b/Source/CursesDialog/CMakeLists.txt
@@ -34,4 +34,4 @@ add_executable(ccmake ${CURSES_SRCS} )
target_link_libraries(ccmake CMakeLib)
target_link_libraries(ccmake cmForm)
-install_targets(/bin ccmake)
+install(TARGETS ccmake DESTINATION bin)
diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in
index 114afd7b77..ab53b1d27f 100644
--- a/Source/cmConfigure.cmake.h.in
+++ b/Source/cmConfigure.cmake.h.in
@@ -19,4 +19,4 @@
#cmakedefine CMAKE_STRICT
#define CMAKE_ROOT_DIR "${CMake_SOURCE_DIR}"
#define CMAKE_BUILD_DIR "${CMake_BINARY_DIR}"
-#define CMAKE_DATA_DIR "@CMAKE_DATA_DIR@"
+#define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@"
diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt
index 91965e9b11..bad8d630e6 100644
--- a/Utilities/CMakeLists.txt
+++ b/Utilities/CMakeLists.txt
@@ -123,11 +123,12 @@ add_custom_command(
MAIN_DEPENDENCY ${CMake_SOURCE_DIR}/Utilities/Doxygen/authors.txt
)
-install_files(${CMAKE_MAN_DIR}/man1 FILES ${MAN_FILES})
-install_files(${CMAKE_DOC_DIR} FILES
+install(FILES ${MAN_FILES} DESTINATION ${CMAKE_MAN_DIR}/man1)
+install(FILES
${TEXT_FILES}
${HTML_FILES}
${DOCBOOK_FILES}
+ DESTINATION ${CMAKE_DOC_DIR}
)
install(FILES cmake.m4 DESTINATION share/aclocal)
diff --git a/Utilities/cmcompress/CMakeLists.txt b/Utilities/cmcompress/CMakeLists.txt
index 3323dcd7d0..806357327c 100644
--- a/Utilities/cmcompress/CMakeLists.txt
+++ b/Utilities/cmcompress/CMakeLists.txt
@@ -2,4 +2,4 @@ PROJECT(CMCompress)
ADD_LIBRARY(cmcompress cmcompress.c)
-INSTALL(FILES Copyright.txt DESTINATION ${CMake_DOC_DEST}/cmcompress)
+INSTALL(FILES Copyright.txt DESTINATION ${CMAKE_DOC_DIR}/cmcompress)
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt
index 320612cf68..74a713dd81 100644
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -716,7 +716,7 @@ TARGET_LINK_LIBRARIES(cmcurl ${CURL_LIBS})
IF(CMAKE_BUILD_CURL_SHARED)
SET_TARGET_PROPERTIES(cmcurl PROPERTIES DEFINE_SYMBOL BUILDING_LIBCURL
RUNTIME_OUTPUT_DIRECTORY ${CMake_BIN_DIR})
- INSTALL_TARGETS(/bin cmcurl)
+ INSTALL(TARGETS cmcurl RUNTIME DESTINATION bin)
ENDIF(CMAKE_BUILD_CURL_SHARED)
OPTION(CURL_TESTING "Do libCurl testing" OFF)
@@ -731,4 +731,4 @@ IF(CMAKE_CURL_TEST_URL)
ADD_TEST(curl LIBCURL ${CMAKE_CURL_TEST_URL})
ENDIF(CMAKE_CURL_TEST_URL)
-INSTALL(FILES COPYING DESTINATION ${CMake_DOC_DEST}/cmcurl)
+INSTALL(FILES COPYING DESTINATION ${CMAKE_DOC_DIR}/cmcurl)
diff --git a/Utilities/cmexpat/CMakeLists.txt b/Utilities/cmexpat/CMakeLists.txt
index b75c11232c..51ba413e5c 100644
--- a/Utilities/cmexpat/CMakeLists.txt
+++ b/Utilities/cmexpat/CMakeLists.txt
@@ -31,4 +31,4 @@ CONFIGURE_FILE(${CMEXPAT_SOURCE_DIR}/expat.h
${CMEXPAT_BINARY_DIR}/expat.h)
ADD_LIBRARY(cmexpat ${expat_SRCS})
-INSTALL(FILES COPYING DESTINATION ${CMake_DOC_DEST}/cmexpat)
+INSTALL(FILES COPYING DESTINATION ${CMAKE_DOC_DIR}/cmexpat)
diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt
index 621888c34c..8ef0e89d6d 100644
--- a/Utilities/cmlibarchive/CMakeLists.txt
+++ b/Utilities/cmlibarchive/CMakeLists.txt
@@ -1311,4 +1311,4 @@ ENDIF(APPLE)
add_subdirectory(libarchive)
-install(FILES COPYING DESTINATION ${CMake_DOC_DEST}/cmlibarchive)
+install(FILES COPYING DESTINATION ${CMAKE_DOC_DIR}/cmlibarchive)
diff --git a/Utilities/cmzlib/CMakeLists.txt b/Utilities/cmzlib/CMakeLists.txt
index c42a434858..f161056e52 100644
--- a/Utilities/cmzlib/CMakeLists.txt
+++ b/Utilities/cmzlib/CMakeLists.txt
@@ -40,4 +40,4 @@ ENDFOREACH(name)
ADD_LIBRARY(cmzlib ${ZLIB_SRCS})
-INSTALL(FILES Copyright.txt DESTINATION ${CMake_DOC_DEST}/cmzlib)
+INSTALL(FILES Copyright.txt DESTINATION ${CMAKE_DOC_DIR}/cmzlib)
diff --git a/bootstrap b/bootstrap
index afb66e5918..fb4a0a0544 100755
--- a/bootstrap
+++ b/bootstrap
@@ -43,9 +43,9 @@ if [ "$cmake_version_tweak" != "0" ]; then
cmake_version="${cmake_version}.${cmake_version_tweak}"
fi
-cmake_data_dir="/share/cmake-${cmake_version_major}.${cmake_version_minor}"
-cmake_doc_dir="/doc/cmake-${cmake_version_major}.${cmake_version_minor}"
-cmake_man_dir="/man"
+cmake_data_dir="share/cmake-${cmake_version_major}.${cmake_version_minor}"
+cmake_doc_dir="doc/cmake-${cmake_version_major}.${cmake_version_minor}"
+cmake_man_dir="man"
cmake_init_file=""
cmake_bootstrap_system_libs=""
cmake_bootstrap_qt_gui=""
@@ -160,8 +160,8 @@ if ${cmake_system_mingw}; then
fi
elif ${cmake_system_haiku}; then
cmake_default_prefix=`finddir B_COMMON_DIRECTORY`
- cmake_man_dir="/documentation/man"
- cmake_doc_dir="/documentation/doc/cmake-${cmake_version}"
+ cmake_man_dir="documentation/man"
+ cmake_doc_dir="documentation/doc/cmake-${cmake_version}"
else
cmake_default_prefix="/usr/local"
fi
@@ -353,13 +353,13 @@ Configuration:
Directory and file names:
--prefix=PREFIX install files in tree rooted at PREFIX
- [${cmake_default_prefix}]
+ ['"${cmake_default_prefix}"']
--datadir=DIR install data files in PREFIX/DIR
- [/share/CMake]
+ ['"${cmake_data_dir}"']
--docdir=DIR install documentation files in PREFIX/DIR
- [/doc/CMake]
+ ['"${cmake_doc_dir}"']
--mandir=DIR install man pages files in PREFIX/DIR/manN
- [/man]
+ ['"${cmake_man_dir}"']
'
exit 10
}
@@ -1400,7 +1400,7 @@ cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_versi
cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_TWEAK ${cmake_version_tweak}"
cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION \"${cmake_version}\""
cmake_report cmConfigure.h${_tmp} "#define CMAKE_ROOT_DIR \"${cmake_root_dir}\""
-cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"${cmake_data_dir}\""
+cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/${cmake_data_dir}\""
cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP"
# Regenerate configured headers