CMakeJavaInformation.cmake 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. # This should be included before the _INIT variables are
  4. # used to initialize the cache. Since the rule variables
  5. # have if blocks on them, users can still define them here.
  6. # But, it should still be after the platform file so changes can
  7. # be made to those values.
  8. if(CMAKE_USER_MAKE_RULES_OVERRIDE)
  9. # Save the full path of the file so try_compile can use it.
  10. include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override)
  11. set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}")
  12. endif()
  13. if(CMAKE_USER_MAKE_RULES_OVERRIDE_Java)
  14. # Save the full path of the file so try_compile can use it.
  15. include(${CMAKE_USER_MAKE_RULES_OVERRIDE_Java} RESULT_VARIABLE _override)
  16. set(CMAKE_USER_MAKE_RULES_OVERRIDE_Java "${_override}")
  17. endif()
  18. # this is a place holder if java needed flags for javac they would go here.
  19. if(NOT CMAKE_Java_CREATE_STATIC_LIBRARY)
  20. # if(WIN32)
  21. # set(class_files_mask "*.class")
  22. # else()
  23. set(class_files_mask ".")
  24. # endif()
  25. set(CMAKE_Java_CREATE_STATIC_LIBRARY
  26. "<CMAKE_Java_ARCHIVE> -cf <TARGET> -C <OBJECT_DIR> ${class_files_mask}")
  27. # "${class_files_mask}" should really be "<OBJECTS>" but compiling a *.java
  28. # file can create more than one *.class file...
  29. endif()
  30. # compile a Java file into an object file
  31. if(NOT CMAKE_Java_COMPILE_OBJECT)
  32. set(CMAKE_Java_COMPILE_OBJECT
  33. "<CMAKE_Java_COMPILER> <FLAGS> <SOURCE> -d <OBJECT_DIR>")
  34. endif()
  35. # set java include flag option and the separator for multiple include paths
  36. set(CMAKE_INCLUDE_FLAG_Java "-classpath ")
  37. if(WIN32 AND NOT CYGWIN)
  38. set(CMAKE_INCLUDE_FLAG_SEP_Java ";")
  39. else()
  40. set(CMAKE_INCLUDE_FLAG_SEP_Java ":")
  41. endif()