@@ -94,13 +94,15 @@ set_target_properties ( ${LIB_NAME}-static
94
94
PROPERTIES
95
95
OUTPUT_NAME ${LIB_NAME}
96
96
PREFIX lib
97
- VERSION ${VERSION} )
97
+ VERSION ${VERSION}
98
+ ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /lib )
98
99
set_target_properties ( ${LIB_NAME}
99
100
PROPERTIES
100
101
OUTPUT_NAME ${LIB_NAME}
101
102
PREFIX lib
102
103
SOVERSION ${VERSION_MAJOR} .${VERSION_MINOR}
103
- VERSION ${VERSION} )
104
+ VERSION ${VERSION}
105
+ LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /lib )
104
106
105
107
#-------------------------------------
106
108
# Build the documentation with ROBODoc
@@ -112,24 +114,28 @@ if ( NOT ROBODOC_SKIP_DOC_GEN )
112
114
if ( ROBODOC ) # Found
113
115
set ( ROBODOC_OPTIONS --tabsize 4 --index --toc --sections --syntaxcolors --source_line_numbers
114
116
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 " )
116
118
set ( REQUIRED_ROBODOC_OPTIONS
117
119
--src "${CMAKE_SOURCE_DIR} /src" --doc "${DOC_DIR} "
118
120
--multidoc --html --ignore_case_when_linking
119
121
--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}
126
133
COMMAND "${CMAKE_COMMAND} " -E make_directory "${DOC_DIR} " # Ensure DOC_DIR exists at build time
127
134
COMMAND "${ROBODOC} " ${REQUIRED_ROBODOC_OPTIONS} ${ROBODOC_OPTIONS}
128
135
DEPENDS "${CMAKE_SOURCE_DIR} /${JF_LIB_SRCS} "
129
136
COMMENT "Building HTML documentation for ${CMAKE_PROJECT_NAME} using ROBODoc" )
130
137
add_custom_target ( documentation ALL
131
- DEPENDS ${ROBO_OUTPUTS} )
132
- set_directory_properties ( PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES doc )
138
+ DEPENDS ${ROBODOC_OUTPUTS} )
133
139
else ( ROBODOC ) # Not found
134
140
message ( WARNING
135
141
"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