From: Yegor Yefremov
Use PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR to refer to the top
source directory.
---
CMakeLists.txt| 22 +-
doc/CMakeLists.txt| 26 ++
doc/Doxyfile.in | 8
doc/Doxyfile.xml.in | 2 +-
python/CMakeLists.txt | 22 +-
5 files changed, 45 insertions(+), 35 deletions(-)
create mode 100644 doc/CMakeLists.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f36912d..24da84d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -142,27 +142,7 @@ add_custom_target(dist
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
if ( DOCUMENTATION )
- find_package ( Doxygen REQUIRED)
-
- # Copy doxy.config.in
- set(top_srcdir ${CMAKE_SOURCE_DIR})
- configure_file(${CMAKE_SOURCE_DIR}/doc/Doxyfile.in
${CMAKE_BINARY_DIR}/Doxyfile )
- configure_file(${CMAKE_SOURCE_DIR}/doc/Doxyfile.xml.in
${CMAKE_BINARY_DIR}/Doxyfile.xml )
-
- # Run doxygen
- add_custom_command(
-OUTPUT ${CMAKE_BINARY_DIR}/doc/html/index.html
-COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/doc
-COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile
-COMMENT "Generating API documentation"
-DEPENDS ${c_headers};${c_sources};${cpp_sources};${cpp_headers}
- )
-
- add_custom_target(
-docs ALL
-COMMENT "Documentation target docs"
-DEPENDS ${CMAKE_BINARY_DIR}/doc/html/index.html
- )
+ add_subdirectory(doc)
endif ( DOCUMENTATION )
add_subdirectory(src)
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
new file mode 100644
index 000..983301d
--- /dev/null
+++ b/doc/CMakeLists.txt
@@ -0,0 +1,26 @@
+find_package ( Doxygen REQUIRED )
+
+# Copy doxy.config.in
+configure_file(
+ ${PROJECT_SOURCE_DIR}/doc/Doxyfile.in
+ ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+)
+
+configure_file(
+ ${PROJECT_SOURCE_DIR}/doc/Doxyfile.xml.in
+ ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.xml
+)
+
+# Run doxygen
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/index.html
+ COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+ COMMENT "Generating API documentation"
+ DEPENDS ${c_headers};${c_sources};${cpp_sources};${cpp_headers}
+)
+
+add_custom_target(
+ docs ALL
+ COMMENT "Documentation target docs"
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html/index.html
+)
diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in
index d7ddff8..a05fe57 100644
--- a/doc/Doxyfile.in
+++ b/doc/Doxyfile.in
@@ -58,7 +58,7 @@ PROJECT_LOGO =
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
-OUTPUT_DIRECTORY = doc
+OUTPUT_DIRECTORY = @CMAKE_CURRENT_BINARY_DIR@
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format
and
@@ -759,8 +759,8 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
-INPUT = @top_srcdir@/src \
- @top_srcdir@/ftdipp
+INPUT = @PROJECT_SOURCE_DIR@/src \
+ @PROJECT_SOURCE_DIR@/ftdipp
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@@ -833,7 +833,7 @@ EXCLUDE_SYMBOLS=
# that contain example code fragments that are included (see the \include
# command).
-EXAMPLE_PATH = @top_srcdir@/examples
+EXAMPLE_PATH = @PROJECT_SOURCE_DIR@/examples
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
diff --git a/doc/Doxyfile.xml.in b/doc/Doxyfile.xml.in
index 8a32509..ab57478 100644
--- a/doc/Doxyfile.xml.in
+++ b/doc/Doxyfile.xml.in
@@ -2,7 +2,7 @@
# xml generation only
# keep settings but shut off all other generation
-@INCLUDE = Doxyfile
+@INCLUDE = doc/Doxyfile
GENERATE_TODOLIST = NO
GENERATE_TESTLIST = NO
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index f8ac423..6ab14cd 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -56,24 +56,28 @@ install ( TARGETS ${SWIG_MODULE_ftdi1_REAL_NAME} LIBRARY
DESTINATION ${PYTHON_MO
if ( DOCUMENTATION )
# Run doxygen to only generate the xml
- add_custom_command ( OUTPUT ${CMAKE_BINARY_DIR}/doc/xml/ftdi_8c.xml
-COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/doc
-COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile.xml
-WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ add_custom_command ( OUTPUT ${PROJECT_BINARY_DIR}/doc/xml/ftdi_8c.xml
+COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/doc/Doxyfile.xml
+WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
+COMMENT "Generating ftdi_8c.xml"
DEPENDS ${c_headers};${c_sources};${cpp_sources};${cpp_headers}