Fix doxygen doc generation if C++ wrapper is not built
authorMichel Zou <xantares09@hotmail.com>
Fri, 31 Aug 2012 15:25:01 +0000 (17:25 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Fri, 31 Aug 2012 15:25:01 +0000 (17:25 +0200)
CMakeLists.txt
doc/Doxyfile.in
ftdipp/CMakeLists.txt
src/CMakeLists.txt

index 14911ad..67640dc 100644 (file)
@@ -122,31 +122,19 @@ option(DOCUMENTATION "Generate API documentation with Doxygen" ON)
 find_package(Doxygen)
 if(DOCUMENTATION AND DOXYGEN_FOUND)
 
-   # Set variables
-   set(top_srcdir ${CMAKE_SOURCE_DIR})
-
    # Find doxy config
    message(STATUS "Doxygen found.")
-   set(DOXY_DIR "${CMAKE_SOURCE_DIR}/doc")
-   set(DOXY_CONFIG "${DOXY_DIR}/Doxyfile.in")
 
    # Copy doxy.config.in
-   configure_file("${DOXY_CONFIG}" "${CMAKE_BINARY_DIR}/doxy.config")
-
-   # Create doc directory
-   add_custom_command(
-   OUTPUT ${CMAKE_BINARY_DIR}/doc
-   COMMAND rm -rf ${CMAKE_BINARY_DIR}/doc/{html,man}
-   COMMAND mkdir -p ${CMAKE_BINARY_DIR}/doc
-   DEPENDS ftdi1 ftdipp1
-   )
+   set(top_srcdir ${CMAKE_SOURCE_DIR})
+   configure_file(${CMAKE_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_BINARY_DIR}/Doxyfile )
 
    # Run doxygen
    add_custom_command(
-   OUTPUT ${CMAKE_BINARY_DIR}/doc/html/index.html
-   COMMAND ${DOXYGEN_EXECUTABLE} "${CMAKE_BINARY_DIR}/doxy.config"
-   DEPENDS "${CMAKE_BINARY_DIR}/doxy.config" "${CMAKE_BINARY_DIR}/doc"
-   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/doc
+    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
+    DEPENDS ${c_headers};${c_sources};${cpp_sources};${cpp_headers}
    )
 
    add_custom_target(docs ALL DEPENDS ${CMAKE_BINARY_DIR}/doc/html/index.html)
index b5c45cc..7ccead3 100644 (file)
@@ -51,7 +51,7 @@ PROJECT_LOGO           =
 # If a relative path is entered, it will be relative to the location
 # where doxygen was started. If left blank the current directory will be used.
 
-OUTPUT_DIRECTORY       =
+OUTPUT_DIRECTORY       = doc
 
 # 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
index 48e5a76..16184ee 100644 (file)
@@ -3,6 +3,10 @@ set(FTDI_BUILD_CPP False PARENT_SCOPE)
 
 option(FTDIPP "Build C++ binding library libftdi1++" ON)
 
+# Targets
+set(cpp_sources   ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.cpp CACHE INTERNAL "List of cpp sources" )
+set(cpp_headers   ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.hpp CACHE INTERNAL "List of cpp headers" )
+        
 if (FTDIPP)
 
     if(Boost_FOUND)
@@ -14,9 +18,7 @@ if (FTDIPP)
 
         include_directories(${Boost_INCLUDE_DIRS})
 
-        # Targets
-        set(cpp_sources   ftdi.cpp)
-        set(cpp_headers   ftdi.hpp)
+
 
         set(FTDI_BUILD_CPP True PARENT_SCOPE)
         message(STATUS "Building libftdi1++")
index 0b8c009..1f39ee7 100644 (file)
@@ -18,8 +18,8 @@ message(STATUS "Detected git snapshot version: ${SNAPSHOT_VERSION}")
 configure_file(ftdi_version_i.h.in "${CMAKE_CURRENT_BINARY_DIR}/ftdi_version_i.h" @ONLY)
 
 # Targets
-set(c_sources     ftdi.c ftdi_stream.c)
-set(c_headers     ftdi.h)
+set(c_sources     ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.c ${CMAKE_CURRENT_SOURCE_DIR}/ftdi_stream.c CACHE INTERNAL "List of c sources" )
+set(c_headers     ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.h CACHE INTERNAL "List of c headers" )
 
 add_library(ftdi1 SHARED ${c_sources})