Skip to content

Instantly share code, notes, and snippets.

@Ybalrid
Created June 10, 2021 22:16
Show Gist options
  • Save Ybalrid/7fcd2fcfbf80df31cea9af592c327cd9 to your computer and use it in GitHub Desktop.
Save Ybalrid/7fcd2fcfbf80df31cea9af592c327cd9 to your computer and use it in GitHub Desktop.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 44467373..21feea9a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -219,28 +219,33 @@ install(TARGETS ${PHYSFS_INSTALL_TARGETS}
ARCHIVE DESTINATION lib${LIB_SUFFIX})
install(FILES src/physfs.h DESTINATION include)
-find_package(Doxygen)
-if(DOXYGEN_FOUND)
- set(PHYSFS_OUTPUT_DOXYFILE "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile")
- configure_file(
- "${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile"
- "${PHYSFS_OUTPUT_DOXYFILE}"
- COPYONLY
- )
- file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "\n\n# Below auto-generated by cmake...\n\n")
- file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "PROJECT_NUMBER = \"${PHYSFS_VERSION}\"\n")
- file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "OUTPUT_DIRECTORY = \"${CMAKE_CURRENT_BINARY_DIR}/docs\"\n")
- file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "\n# End auto-generated section.\n\n")
+option(PHYSFS_BUILD_DOCS "Build doxygen based documentation" TRUE)
+if(PHYSFS_BUILD_DOCS)
+ find_package(Doxygen)
+ if(DOXYGEN_FOUND)
+ set(PHYSFS_OUTPUT_DOXYFILE "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile")
+ configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile"
+ "${PHYSFS_OUTPUT_DOXYFILE}"
+ COPYONLY
+ )
+ file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "\n\n# Below auto-generated by cmake...\n\n")
+ file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "PROJECT_NUMBER = \"${PHYSFS_VERSION}\"\n")
+ file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "OUTPUT_DIRECTORY = \"${CMAKE_CURRENT_BINARY_DIR}/docs\"\n")
+ file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "\n# End auto-generated section.\n\n")
+
+ set(PHYSFS_TARGETNAME_DOCS "docs" CACHE STRING "Name of 'docs' build target")
+
+ add_custom_target(
+ ${PHYSFS_TARGETNAME_DOCS}
+ ${DOXYGEN_EXECUTABLE} "${PHYSFS_OUTPUT_DOXYFILE}"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+ COMMENT "Building documentation in 'docs' directory..."
+ )
- set(PHYSFS_TARGETNAME_DOCS "docs" CACHE STRING "Name of 'docs' build target")
- add_custom_target(
- ${PHYSFS_TARGETNAME_DOCS}
- ${DOXYGEN_EXECUTABLE} "${PHYSFS_OUTPUT_DOXYFILE}"
- WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
- COMMENT "Building documentation in 'docs' directory..."
- )
-else()
- message(STATUS "Doxygen not found. You won't be able to build documentation.")
+ else()
+ message(STATUS "Doxygen not found. You won't be able to build documentation.")
+ endif()
endif()
if(UNIX)
@@ -297,6 +302,7 @@ message_bool_option("ISO9660 support" PHYSFS_ARCHIVE_ISO9660)
message_bool_option("Build static library" PHYSFS_BUILD_STATIC)
message_bool_option("Build shared library" PHYSFS_BUILD_SHARED)
message_bool_option("Build stdio test program" PHYSFS_BUILD_TEST)
+message_bool_option("Build Doxygen documentation" PHYSFS_BUILD_DOCS)
if(PHYSFS_BUILD_TEST)
message_bool_option(" Use readline in test program" HAVE_SYSTEM_READLINE)
endif()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment