diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-07-18 19:04:12 -0500 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-07-19 22:41:18 -0500 |
commit | af66df4e028cac52d75dd5a585a16426083bd5af (patch) | |
tree | 4b870f190b8284db48851400a3d64bcf9e859d4e /cmake | |
parent | 4f7af51285d9b8991929d7e01b3ae6a980e53eb5 (diff) | |
download | pki-af66df4e028cac52d75dd5a585a16426083bd5af.tar.gz pki-af66df4e028cac52d75dd5a585a16426083bd5af.tar.xz pki-af66df4e028cac52d75dd5a585a16426083bd5af.zip |
Added Javadoc CMake function.
A new javadoc function has been added into Java CMake script. The
function supports generating Javadoc for Java packages including
all subpackages in it. It also support package exclusion. This way
it's no longer necessary to specify the entire list of packages or
source codes.
Ticket #62
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Modules/Java.cmake | 140 |
1 files changed, 121 insertions, 19 deletions
diff --git a/cmake/Modules/Java.cmake b/cmake/Modules/Java.cmake index 62f26f9fc..bd2855baf 100644 --- a/cmake/Modules/Java.cmake +++ b/cmake/Modules/Java.cmake @@ -27,27 +27,27 @@ function(javac target) if (arg MATCHES "(SOURCE_DIR|SOURCES|EXCLUDE|CLASSPATH|OUTPUT_DIR|DEPENDS)") set(param ${arg}) - else (arg MATCHES "(SOURCE_DIR|SOURCES|EXCLUDE|CLASSPATH|OUTPUT_DIR|DEPENDS)") + else () - if (param MATCHES "SOURCE_DIR") + if (param STREQUAL "SOURCE_DIR") set(source_dir ${arg}) - elseif (param MATCHES "SOURCES") + elseif (param STREQUAL "SOURCES") list(APPEND sources ${arg}) - elseif (param MATCHES "EXCLUDE") + elseif (param STREQUAL "EXCLUDE") list(APPEND exclude ${arg}) - elseif (param MATCHES "CLASSPATH") + elseif (param STREQUAL "CLASSPATH") list(APPEND classpath ${arg}) - elseif (param MATCHES "OUTPUT_DIR") + elseif (param STREQUAL "OUTPUT_DIR") set(output_dir ${arg}) - elseif (param MATCHES "DEPENDS") + elseif (param STREQUAL "DEPENDS") list(APPEND depends ${arg}) - endif(param MATCHES "SOURCE_DIR") + endif(param STREQUAL "SOURCE_DIR") endif(arg MATCHES "(SOURCE_DIR|SOURCES|EXCLUDE|CLASSPATH|OUTPUT_DIR|DEPENDS)") @@ -92,11 +92,11 @@ function(jar target) foreach (arg ${ARGN}) - if (arg MATCHES "CREATE") + if (arg STREQUAL "CREATE") set(param ${arg}) set(operation "c") - elseif (arg MATCHES "UPDATE") + elseif (arg STREQUAL "UPDATE") set(param ${arg}) set(operation "u") @@ -108,21 +108,21 @@ function(jar target) if (param MATCHES "(CREATE|UPDATE)") set(output ${arg}) - elseif (param MATCHES "INPUT_DIR") + elseif (param STREQUAL "INPUT_DIR") set(input_dir ${arg}) - elseif (param MATCHES "FILES") + elseif (param STREQUAL "FILES") list(APPEND files ${arg}) - elseif (param MATCHES "EXCLUDE") + elseif (param STREQUAL "EXCLUDE") list(APPEND exclude ${arg}) - elseif (param MATCHES "DEPENDS") + elseif (param STREQUAL "DEPENDS") list(APPEND depends ${arg}) endif(param MATCHES "(CREATE|UPDATE)") - endif(arg MATCHES "CREATE") + endif(arg STREQUAL "CREATE") endforeach(arg) @@ -146,6 +146,108 @@ function(jar target) endfunction(jar) +function(javadoc target) + + set(sourcepath ${CMAKE_CURRENT_SOURCE_DIR}) + set(dest ${CMAKE_CURRENT_BINARY_DIR}/javadoc) + + foreach (arg ${ARGN}) + + if (arg MATCHES "(SOURCEPATH|CLASSPATH|FILES|PACKAGES|SUBPACKAGES|EXCLUDE|OPTIONS|DEST|DEPENDS)") + set(param ${arg}) + + else () + + if (param STREQUAL "SOURCEPATH") + list(APPEND sourcepath ${arg}) + + elseif (param STREQUAL "CLASSPATH") + list(APPEND classpath ${arg}) + + elseif (param STREQUAL "FILES") + list(APPEND files ${arg}) + + elseif (param STREQUAL "PACKAGES") + list(APPEND packages ${arg}) + + elseif (param STREQUAL "SUBPACKAGES") + list(APPEND subpackages ${arg}) + + elseif (param STREQUAL "EXCLUDE") + list(APPEND exclude ${arg}) + + elseif (param STREQUAL "OPTIONS") + list(APPEND options ${arg}) + + elseif (param STREQUAL "DEST") + set(dest ${arg}) + + elseif (param STREQUAL "DEPENDS") + list(APPEND depends ${arg}) + + endif(param STREQUAL "SOURCEPATH") + + endif(arg MATCHES "(SOURCEPATH|CLASSPATH|FILES|PACKAGES|SUBPACKAGES|EXCLUDE|DEST|DEPENDS)") + + endforeach(arg) + + if (UNIX) + set(separator ":") + else (UNIX) + set(separator ";") + endif(UNIX) + + set(command ${JAVA_DOC} -d ${dest}) + + if (options) + foreach (option ${options}) + set(command ${command} ${option}) + endforeach(option ${options}) + endif(sourcepath) + + if (sourcepath) + set(tmp) + foreach (path ${sourcepath}) + set(tmp "${tmp}${separator}${path}") + endforeach(path) + set(command ${command} -sourcepath ${tmp}) + endif(sourcepath) + + if (classpath) + set(tmp) + foreach (path ${classpath}) + set(tmp "${tmp}${separator}${path}") + endforeach(path) + set(command ${command} -classpath ${tmp}) + endif(classpath) + + if (subpackages) + set(tmp) + foreach (package ${subpackages}) + set(tmp "${tmp}:${package}") + endforeach(path) + set(command ${command} -subpackages ${tmp}) + endif(subpackages) + + if (exclude) + set(tmp) + foreach (package ${exclude}) + set(tmp "${tmp}:${package}") + endforeach(path) + set(command ${command} -exclude ${tmp}) + endif(exclude) + + set(command ${command} ${files} ${packages}) + + add_custom_target(${target} ALL DEPENDS ${depends}) + + add_custom_command( + TARGET ${target} + COMMAND ${command} + ) + +endfunction(javadoc) + function(link target) foreach (arg ${ARGN}) @@ -155,16 +257,16 @@ function(link target) else () - if (param MATCHES "SOURCE") + if (param STREQUAL "SOURCE") set(source ${arg}) - elseif (param MATCHES "DEST") + elseif (param STREQUAL "DEST") set(dest ${arg}) - elseif (param MATCHES "DEPENDS") + elseif (param STREQUAL "DEPENDS") list(APPEND depends ${arg}) - endif(param MATCHES "SOURCE") + endif(param STREQUAL "SOURCE") endif(arg MATCHES "(SOURCE|DEST|DEPENDS)") |