Skip to content

Commit

Permalink
cmake: use quotes for paths
Browse files Browse the repository at this point in the history
  • Loading branch information
leissa committed Sep 29, 2023
1 parent 1251b33 commit 1f8f1ab
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 30 deletions.
36 changes: 20 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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}")
27 changes: 13 additions & 14 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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})

0 comments on commit 1f8f1ab

Please sign in to comment.