> From: [email protected]
> To: [email protected]
> Subject: Re: CMake fails if c++ not built and doxygen doc
> Date: Wed, 29 Aug 2012 12:55:10 +0200
> 
> Hi M.,
> 
> On Thursday, 23. August 2012 12:36:54 xantares 09 wrote:
> > The generation of the doxygen docs depends on libftdipp.
> > 
> > 
> > Libftdipp is not build is boost not found.
> > 
> > 
> > So cmake fails to build if doc is activated and c++ wrapper is not found.
> > 
> > 
> > 
> > I suggest to not rebuild automatically the doc each time, but once on
> > demand. Here is a patch doing that, otherwise consider removing the
> > 'DEPENDS ftdi1 ftdipp1' line as the doc is rebuilt anyway.
> 
> or you could depend on the ftdipp1 source files instead of the built 
> library. 
> 
> That was the original idea anyway: Regenerate the docs
> if the source file changes.
> 
> Any reason not to generate the docs once the source changes?
> 
> Thomas
> 
> 
> --
> libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
> To unsubscribe send a mail to [email protected]   
> 


Ok,

Here is another patch to keep the current behavior while depending only on the 
source files.

By the way generating the doc can be expensive with lots of graphs and stuff.

M.




                                          

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [email protected]   

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 14911ad..67640dc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in
index b5c45cc..7ccead3 100644
--- a/doc/Doxyfile.in
+++ b/doc/Doxyfile.in
@@ -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
diff --git a/ftdipp/CMakeLists.txt b/ftdipp/CMakeLists.txt
index 48e5a76..16184ee 100644
--- a/ftdipp/CMakeLists.txt
+++ b/ftdipp/CMakeLists.txt
@@ -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++")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0b8c009..1f39ee7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -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})
 

Reply via email to