@@ -94,13 +94,15 @@ set_target_properties ( ${LIB_NAME}-static
9494 PROPERTIES
9595 OUTPUT_NAME ${LIB_NAME}
9696 PREFIX lib
97- VERSION ${VERSION} )
97+ VERSION ${VERSION}
98+ ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /lib )
9899set_target_properties ( ${LIB_NAME}
99100 PROPERTIES
100101 OUTPUT_NAME ${LIB_NAME}
101102 PREFIX lib
102103 SOVERSION ${VERSION_MAJOR} .${VERSION_MINOR}
103- VERSION ${VERSION} )
104+ VERSION ${VERSION}
105+ LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /lib )
104106
105107#-------------------------------------
106108# Build the documentation with ROBODoc
@@ -112,24 +114,28 @@ if ( NOT ROBODOC_SKIP_DOC_GEN )
112114 if ( ROBODOC ) # Found
113115 set ( ROBODOC_OPTIONS --tabsize 4 --index --toc --sections --syntaxcolors --source_line_numbers
114116 CACHE STRING "Options passed to robodoc to control building the documentation" )
115- set ( DOC_DIR "${CMAKE_BINARY_DIR} /doc " )
117+ set ( DOC_DIR "${CMAKE_BINARY_DIR} /documentation " )
116118 set ( REQUIRED_ROBODOC_OPTIONS
117119 --src "${CMAKE_SOURCE_DIR} /src" --doc "${DOC_DIR} "
118120 --multidoc --html --ignore_case_when_linking
119121 --documenttitle "${CMAKE_PROJECT_NAME} " )
120- set ( ROBODOC_OUPUTS json_example_f90.html masterindex.html robo_functions.html robo_sourcefiles.html
121- toc_index.html json_module_f90.html robo_classes.html robo_modules.html robodoc.css )
122- foreach ( ARG ${ROBODOC_OUPUTS} )
123- set ( ROBO_OUTPUTS "${DOC_DIR} /${ARG} " )
124- endforeach ( ARG ${ROBODOC_OUPUTS} )
125- add_custom_command ( OUTPUT ${ROBO_OUTPUTS}
122+ # Dynamically generate the ROBODoc outputs list
123+ message ( STATUS "Dynamically computing ROBODoc output information..." )
124+ execute_process ( COMMAND ${CMAKE_COMMAND} -E remove_directory ${DOC_DIR}
125+ COMMAND ${CMAKE_COMMAND} -E make_directory ${DOC_DIR}
126+ COMMAND "${ROBODOC} " ${REQUIRED_ROBODOC_OPTIONS} ${ROBODOC_OPTIONS} )
127+ file ( GLOB_RECURSE ROBODOC_OUTPUTS
128+ "${DOC_DIR} /*" )
129+ execute_process ( COMMAND ${CMAKE_COMMAND} -E remove_directory ${DOC_DIR} )
130+ message ( STATUS "Done dynamically computing ROBODoc outputs." )
131+
132+ add_custom_command ( OUTPUT ${ROBODOC_OUTPUTS}
126133 COMMAND "${CMAKE_COMMAND} " -E make_directory "${DOC_DIR} " # Ensure DOC_DIR exists at build time
127134 COMMAND "${ROBODOC} " ${REQUIRED_ROBODOC_OPTIONS} ${ROBODOC_OPTIONS}
128135 DEPENDS "${CMAKE_SOURCE_DIR} /${JF_LIB_SRCS} "
129136 COMMENT "Building HTML documentation for ${CMAKE_PROJECT_NAME} using ROBODoc" )
130137 add_custom_target ( documentation ALL
131- DEPENDS ${ROBO_OUTPUTS} )
132- set_directory_properties ( PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES doc )
138+ DEPENDS ${ROBODOC_OUTPUTS} )
133139 else ( ROBODOC ) # Not found
134140 message ( WARNING
135141 "ROBODoc not found! Please set the CMake cache variable ROBODOC to point to the installed ROBODoc binary, and reconfigure or disable building the documentation. ROBODoc can be installed from: http://www.xs4all.nl/~rfsber/Robo/ If you do not wish to install ROBODoc and build the json-fortran documentation, then please set the CMake cache variable SKIP_DOCUMENTATION_GENERATION to FALSE." )
0 commit comments