From 5f70b4c1691275a3c1d7f9ba4bbae94072d2daf1 Mon Sep 17 00:00:00 2001 From: Michel Zou Date: Fri, 31 Aug 2012 17:25:01 +0200 Subject: [PATCH] Fix doxygen doc generation if C++ wrapper is not built --- CMakeLists.txt | 24 ++++++------------------ doc/Doxyfile.in | 2 +- ftdipp/CMakeLists.txt | 8 +++++--- src/CMakeLists.txt | 4 ++-- 4 files changed, 14 insertions(+), 24 deletions(-) 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}) -- 1.7.1