From 1f8f1abab2320e7cfbb7b87cc69e6b301c96b319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Lei=C3=9Fa?= Date: Fri, 29 Sep 2023 14:29:14 +0200 Subject: [PATCH] cmake: use quotes for paths --- CMakeLists.txt | 36 ++++++++++++++++++++---------------- docs/CMakeLists.txt | 27 +++++++++++++-------------- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dea8fc0e49..f7281d96ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,9 +17,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") option(BUILD_SHARED_LIBS "Build shared libraries." ON) option(THORIN_BUILD_DOCS "If ON, Thorin will build the documentation (requires Doxygen)." OFF) @@ -42,7 +42,7 @@ else() add_compile_options(-Wall -Wextra) endif() -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake) +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") include(Thorin) set(ABSL_PROPAGATE_CXX_STD ON) @@ -90,22 +90,26 @@ include(CMakePackageConfigHelpers) write_basic_package_version_file( "${PROJECT_BINARY_DIR}/thorin-config-version.cmake" VERSION ${Thorin_VERSION} - COMPATIBILITY SameMajorVersion -) + COMPATIBILITY SameMajorVersion) set(THORIN_CMAKE_INSTALL_DIR lib/cmake/thorin) -install(FILES cmake/Thorin.cmake DESTINATION ${THORIN_CMAKE_INSTALL_DIR}) -install(EXPORT install_exports FILE "thorin-targets.cmake" NAMESPACE thorin:: DESTINATION ${THORIN_CMAKE_INSTALL_DIR}) +install( + FILES cmake/Thorin.cmake + DESTINATION "${THORIN_CMAKE_INSTALL_DIR}") + +install( + EXPORT install_exports + FILE thorin-targets.cmake + NAMESPACE thorin:: + DESTINATION "${THORIN_CMAKE_INSTALL_DIR}") configure_package_config_file( - ${PROJECT_SOURCE_DIR}/cmake/thorin-config.cmake.in - ${PROJECT_BINARY_DIR}/thorin-config.cmake - INSTALL_DESTINATION ${THORIN_CMAKE_INSTALL_DIR} -) + "${PROJECT_SOURCE_DIR}/cmake/thorin-config.cmake.in" + "${PROJECT_BINARY_DIR}/thorin-config.cmake" + INSTALL_DESTINATION ${THORIN_CMAKE_INSTALL_DIR}) install(FILES - ${PROJECT_BINARY_DIR}/thorin-config.cmake - ${PROJECT_BINARY_DIR}/thorin-config-version.cmake - DESTINATION ${THORIN_CMAKE_INSTALL_DIR} -) + "${PROJECT_BINARY_DIR}/thorin-config.cmake" + "${PROJECT_BINARY_DIR}/thorin-config-version.cmake" + DESTINATION "${THORIN_CMAKE_INSTALL_DIR}") diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 42b7915f6c..d6a26e14c0 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -1,22 +1,22 @@ -set(CLI_HELP ${CMAKE_CURRENT_BINARY_DIR}/cli-help.sh) +set(CLI_HELP "${CMAKE_CURRENT_BINARY_DIR}/cli-help.sh") add_custom_command( OUTPUT ${CLI_HELP} COMMAND thorin --help > ${CLI_HELP} DEPENDS thorin COMMENT "Generating help text of Thorin's CLI" -) -set(DOXYFILE ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) -set(DOXY_LAYOUT ${CMAKE_CURRENT_BINARY_DIR}/DoxygenLayout.xml) -set(DOXY_INDEX_HTML ${CMAKE_CURRENT_BINARY_DIR}/html/index.html) + +set(DOXYFILE "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile") +set(DOXY_LAYOUT "${CMAKE_CURRENT_BINARY_DIR}/DoxygenLayout.xml") +set(DOXY_INDEX_HTML "${CMAKE_CURRENT_BINARY_DIR}/html/index.html") set(DOXY_EXTRA_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/cli.md - ${CMAKE_CURRENT_SOURCE_DIR}/coding.md - ${CMAKE_CURRENT_SOURCE_DIR}/dev.md - ${CMAKE_CURRENT_SOURCE_DIR}/langref.md - ${CMAKE_CURRENT_SOURCE_DIR}/passes.md - ${CMAKE_CURRENT_SOURCE_DIR}/README.md -) + "${CMAKE_CURRENT_SOURCE_DIR}/cli.md" + "${CMAKE_CURRENT_SOURCE_DIR}/coding."md + "${CMAKE_CURRENT_SOURCE_DIR}/dev.md" + "${CMAKE_CURRENT_SOURCE_DIR}/langref".md + "${CMAKE_CURRENT_SOURCE_DIR}/passes.m"d + "${CMAKE_CURRENT_SOURCE_DIR}/README.md") + string(REPLACE ";" " " DOXY_EXTRA_FILES_CONFIG "${DOXY_EXTRA_FILES}") configure_file(Doxyfile.in ${DOXYFILE} @ONLY) configure_file(DoxygenLayout.xml.in ${DOXY_LAYOUT} @ONLY) @@ -27,7 +27,6 @@ add_custom_command( MAIN_DEPENDENCY ${DOXYFILE} DEPENDS thorin ${CLI_HELP} ${DOXY_EXTRA_FILES} ${DOXY_LAYOUT} COMMENT "Generating Doxygen HTML documentation" - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} -) + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}") add_custom_target(docs ALL DEPENDS ${DOXY_INDEX_HTML} ${THORIN_PLUGIN_LIST})