summaryrefslogtreecommitdiffstats
path: root/Modules/UseJava.cmake
diff options
context:
space:
mode:
authorNathan Burles <nathan.burles@uk.ibm.com>2019-10-31 11:27:18 (GMT)
committerBrad King <brad.king@kitware.com>2019-11-20 15:38:44 (GMT)
commitc7a4b1a58efd3b7ef8794547dcee738e8fd1b483 (patch)
tree63b0aa2a9f374d0dbf0fdbe2692e1a1ca42ae1cc /Modules/UseJava.cmake
parent5f630a934aa4b8616aa59988ea70c14065d3a08d (diff)
downloadCMake-c7a4b1a58efd3b7ef8794547dcee738e8fd1b483.zip
CMake-c7a4b1a58efd3b7ef8794547dcee738e8fd1b483.tar.gz
CMake-c7a4b1a58efd3b7ef8794547dcee738e8fd1b483.tar.bz2
UseJava: Extract the path separator to module level
It is currently only defined within the add_jar function, but is needed inside other functions in this module.
Diffstat (limited to 'Modules/UseJava.cmake')
-rw-r--r--Modules/UseJava.cmake25
1 files changed, 10 insertions, 15 deletions
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index 0798488..96b7c64 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -408,6 +408,12 @@ set(_JAVA_EXPORT_TARGETS_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/javaTargets.cmake.in)
set(_JAVA_CLASS_FILELIST_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaClassFilelist.cmake)
set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake)
+if (CMAKE_HOST_WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
+ set(_UseJava_PATH_SEP "$<SEMICOLON>")
+else ()
+ set(_UseJava_PATH_SEP ":")
+endif()
+
function(add_jar _TARGET_NAME)
cmake_parse_arguments(_add_jar
@@ -497,14 +503,8 @@ function(add_jar _TARGET_NAME)
${CMAKE_JAVA_LIBRARY_OUTPUT_PATH}
)
- if (CMAKE_HOST_WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
- set(CMAKE_JAVA_INCLUDE_FLAG_SEP ";")
- else ()
- set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":")
- endif()
-
foreach (JAVA_INCLUDE_DIR IN LISTS CMAKE_JAVA_INCLUDE_PATH)
- string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}")
+ string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${_UseJava_PATH_SEP}${JAVA_INCLUDE_DIR}")
endforeach()
set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir")
@@ -576,7 +576,7 @@ function(add_jar _TARGET_NAME)
if (TARGET ${_JAVA_INCLUDE_JAR})
get_target_property(_JAVA_JAR_PATH ${_JAVA_INCLUDE_JAR} JAR_FILE)
if (_JAVA_JAR_PATH)
- string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_JAR_PATH}")
+ string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${_UseJava_PATH_SEP}${_JAVA_JAR_PATH}")
list(APPEND CMAKE_JAVA_INCLUDE_PATH ${_JAVA_JAR_PATH})
list(APPEND _JAVA_DEPENDS ${_JAVA_INCLUDE_JAR})
list(APPEND _JAVA_COMPILE_DEPENDS ${_JAVA_JAR_PATH})
@@ -584,7 +584,7 @@ function(add_jar _TARGET_NAME)
message(SEND_ERROR "add_jar: INCLUDE_JARS target ${_JAVA_INCLUDE_JAR} is not a jar")
endif ()
else ()
- string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_INCLUDE_JAR}")
+ string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${_UseJava_PATH_SEP}${_JAVA_INCLUDE_JAR}")
list(APPEND CMAKE_JAVA_INCLUDE_PATH "${_JAVA_INCLUDE_JAR}")
list(APPEND _JAVA_DEPENDS "${_JAVA_INCLUDE_JAR}")
list(APPEND _JAVA_COMPILE_DEPENDS "${_JAVA_INCLUDE_JAR}")
@@ -1274,11 +1274,6 @@ function (create_javah)
endif()
set (_output_files)
- if (WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
- set(_classpath_sep "$<SEMICOLON>")
- else ()
- set(_classpath_sep ":")
- endif()
# handle javah options
set (_javah_options)
@@ -1304,7 +1299,7 @@ function (create_javah)
message(SEND_ERROR "create_javah: CLASSPATH entry ${_path} does not exist.")
endif()
endforeach()
- string (REPLACE ";" "${_classpath_sep}" _classpath "${_classpath}")
+ string (REPLACE ";" "${_UseJava_PATH_SEP}" _classpath "${_classpath}")
list (APPEND _javah_options -classpath "${_classpath}")
endif()