changeset 4:416399d055e9

Added option for Doxygen
author Eris Caffee <discordia@eldalin.com>
date Sun, 07 Apr 2013 00:38:06 -0500
parents acb4b5af3dfa
children 2d4c97813e03
files CMakeLists.txt
diffstat 1 files changed, 56 insertions(+), 20 deletions(-) [+]
line diff
     1.1 --- a/CMakeLists.txt	Tue Mar 29 04:36:57 2011 -0500
     1.2 +++ b/CMakeLists.txt	Sun Apr 07 00:38:06 2013 -0500
     1.3 @@ -66,8 +66,8 @@
     1.4  #set (CMAKE_VERBOSE_MAKEFILE ON)
     1.5  
     1.6  # Name your program!
     1.7 -set (App_Name "")
     1.8 -if (App_Name STREQUAL "") 
     1.9 +set (App_Name "MYAPPNAME")
    1.10 +if (App_Name STREQUAL "MYAPPNAME") 
    1.11    message (FATAL_ERROR "You must set the App_Name variable!")
    1.12  endif ()
    1.13  
    1.14 @@ -167,11 +167,11 @@
    1.15  )
    1.16  
    1.17  
    1.18 -# # An example for a unix library named utils with a test driver program.
    1.19 -
    1.20 -# set (SRCS_utils
    1.21 -#   src/utils.cpp
    1.22 -#   include/utils.h
    1.23 +# Example to build a linux library with a test driver.
    1.24 + 
    1.25 +# set (SRCS_${App_Name}
    1.26 +#   src/.cpp
    1.27 +#   include/.h
    1.28  # )
    1.29  
    1.30  # include_directories (
    1.31 @@ -191,30 +191,66 @@
    1.32  # # clobber each others temp files since they are being built from the same
    1.33  # # sources.
    1.34  
    1.35 -# add_library (utils SHARED
    1.36 -#   ${SRCS_utils}
    1.37 +# add_library (${App_Name} SHARED
    1.38 +#   ${SRCS_${App_Name}}
    1.39  # )
    1.40 -# set_target_properties (utils PROPERTIES OUTPUT_NAME "utils")
    1.41 -# set_target_properties (utils PROPERTIES PREFIX "lib")
    1.42 -# set_target_properties (utils PROPERTIES CLEAN_DIRECT_OUTPUT 1)
    1.43 +# set_target_properties (${App_Name} PROPERTIES OUTPUT_NAME ${App_Name})
    1.44 +# set_target_properties (${App_Name} PROPERTIES PREFIX "lib")
    1.45 +# set_target_properties (${App_Name} PROPERTIES CLEAN_DIRECT_OUTPUT 1)
    1.46  
    1.47 -# add_library (utils-static STATIC
    1.48 -#   ${SRCS_utils}
    1.49 +# add_library (${App_Name}-static STATIC
    1.50 +#   ${SRCS_${App_Name}}
    1.51  # )
    1.52 -# set_target_properties (utils-static PROPERTIES OUTPUT_NAME "utils")
    1.53 -# set_target_properties (utils-static PROPERTIES PREFIX "lib")
    1.54 -# set_target_properties (utils-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
    1.55 +# set_target_properties (${App_Name}-static PROPERTIES OUTPUT_NAME ${App_Name})
    1.56 +# set_target_properties (${App_Name}-static PROPERTIES PREFIX "lib")
    1.57 +# set_target_properties (${App_Name}-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
    1.58  
    1.59  # # Build a test application.
    1.60  
    1.61 -# add_executable (test
    1.62 +# link_directories (
    1.63 +#   )
    1.64 +
    1.65 +# include_directories (
    1.66 +#   ${CMAKE_SOURCE_DIR}/include
    1.67 +#   )
    1.68 +
    1.69 +# add_executable (${App_Name}-test
    1.70  #   src/main.cpp
    1.71  # )
    1.72  
    1.73 -# target_link_libraries (test
    1.74 -#   utils
    1.75 +# target_link_libraries (${App_Name}-test
    1.76 +#   ${App_Name}
    1.77  # )
    1.78  
    1.79 +################################################################################
    1.80 +# Doxygen documentation
    1.81 +#
    1.82 +# - Create a directory named docs to hold your Doxygen config and standalone (.dox) files.
    1.83 +# - Name you Doxyfile config as "Doxyfile.in".
    1.84 +# - In that file, prepend "@CMAKE_CURRENT_SOURCE_DIR@/" to all of the files and directorys listed in the INPUT setting.
    1.85 +# - Set STRIP_FROM_PATH to "@CMAKE_CURRENT_SOURCE_DIR@"
    1.86 +#
    1.87 +# Then you can generate the docs with "make docs" and this will create a "docs" directory under your build directory.
    1.88 +# 
    1.89 +
    1.90 +option(Option_Doxygen "Generate Doxygen documentation." OFF)
    1.91 +
    1.92 +if (Option_Doxygen)
    1.93 +
    1.94 +  find_package(Doxygen)
    1.95 +  if (NOT DOXYGEN_FOUND)
    1.96 +    message (FATAL_ERROR "Doxygen not found!")
    1.97 +  endif ()
    1.98 +
    1.99 +  configure_file (${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/docs/Doxyfile @ONLY)
   1.100 +
   1.101 +  add_custom_target(docs
   1.102 +    ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/docs/Doxyfile
   1.103 +    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
   1.104 +    COMMENT "Generating API documentation with Doxygen" VERBATIM
   1.105 +    )
   1.106 +
   1.107 +endif ()
   1.108  
   1.109  ################################################################################
   1.110  # X11