# HG changeset patch # User Eris Caffee # Date 1365313086 18000 # Node ID 416399d055e9439ade01e7e5b55175c0bf4b996d # Parent acb4b5af3dfa2e34cfb2f9cc8f475b082f8d63e4 Added option for Doxygen diff -r acb4b5af3dfa -r 416399d055e9 CMakeLists.txt --- a/CMakeLists.txt Tue Mar 29 04:36:57 2011 -0500 +++ b/CMakeLists.txt Sun Apr 07 00:38:06 2013 -0500 @@ -66,8 +66,8 @@ #set (CMAKE_VERBOSE_MAKEFILE ON) # Name your program! -set (App_Name "") -if (App_Name STREQUAL "") +set (App_Name "MYAPPNAME") +if (App_Name STREQUAL "MYAPPNAME") message (FATAL_ERROR "You must set the App_Name variable!") endif () @@ -167,11 +167,11 @@ ) -# # An example for a unix library named utils with a test driver program. - -# set (SRCS_utils -# src/utils.cpp -# include/utils.h +# Example to build a linux library with a test driver. + +# set (SRCS_${App_Name} +# src/.cpp +# include/.h # ) # include_directories ( @@ -191,30 +191,66 @@ # # clobber each others temp files since they are being built from the same # # sources. -# add_library (utils SHARED -# ${SRCS_utils} +# add_library (${App_Name} SHARED +# ${SRCS_${App_Name}} # ) -# set_target_properties (utils PROPERTIES OUTPUT_NAME "utils") -# set_target_properties (utils PROPERTIES PREFIX "lib") -# set_target_properties (utils PROPERTIES CLEAN_DIRECT_OUTPUT 1) +# set_target_properties (${App_Name} PROPERTIES OUTPUT_NAME ${App_Name}) +# set_target_properties (${App_Name} PROPERTIES PREFIX "lib") +# set_target_properties (${App_Name} PROPERTIES CLEAN_DIRECT_OUTPUT 1) -# add_library (utils-static STATIC -# ${SRCS_utils} +# add_library (${App_Name}-static STATIC +# ${SRCS_${App_Name}} # ) -# set_target_properties (utils-static PROPERTIES OUTPUT_NAME "utils") -# set_target_properties (utils-static PROPERTIES PREFIX "lib") -# set_target_properties (utils-static PROPERTIES CLEAN_DIRECT_OUTPUT 1) +# set_target_properties (${App_Name}-static PROPERTIES OUTPUT_NAME ${App_Name}) +# set_target_properties (${App_Name}-static PROPERTIES PREFIX "lib") +# set_target_properties (${App_Name}-static PROPERTIES CLEAN_DIRECT_OUTPUT 1) # # Build a test application. -# add_executable (test +# link_directories ( +# ) + +# include_directories ( +# ${CMAKE_SOURCE_DIR}/include +# ) + +# add_executable (${App_Name}-test # src/main.cpp # ) -# target_link_libraries (test -# utils +# target_link_libraries (${App_Name}-test +# ${App_Name} # ) +################################################################################ +# Doxygen documentation +# +# - Create a directory named docs to hold your Doxygen config and standalone (.dox) files. +# - Name you Doxyfile config as "Doxyfile.in". +# - In that file, prepend "@CMAKE_CURRENT_SOURCE_DIR@/" to all of the files and directorys listed in the INPUT setting. +# - Set STRIP_FROM_PATH to "@CMAKE_CURRENT_SOURCE_DIR@" +# +# Then you can generate the docs with "make docs" and this will create a "docs" directory under your build directory. +# + +option(Option_Doxygen "Generate Doxygen documentation." OFF) + +if (Option_Doxygen) + + find_package(Doxygen) + if (NOT DOXYGEN_FOUND) + message (FATAL_ERROR "Doxygen not found!") + endif () + + configure_file (${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/docs/Doxyfile @ONLY) + + add_custom_target(docs + ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/docs/Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating API documentation with Doxygen" VERBATIM + ) + +endif () ################################################################################ # X11