Commit e84f23c4 authored by Julien Malik's avatar Julien Malik

STYLE: Remove CMake-language block-end arguments

Ancient versions of CMake required else(), endif(), and similar block
termination commands to have arguments matching the command starting the
block.  This is no longer the preferred style.

NOTE: MUST USE GNU compliant version of sed
Run the following shell code (Adopted from Brad King scripts for CMake):

for c in else endif endforeach endfunction endmacro endwhile; do
    echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/'
done >convert.sed \
&& git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' \
   | xargs sed -i -f convert.sed \
&& rm convert.sed


This has been adapted from ITK commit e52dbe7fa476f6283c9b9d1507fca052355113a4
parent c89f9a38
......@@ -19,11 +19,11 @@ macro(CHECK_BIG_BITFIELD VARIABLE LOCAL_TEST_DIR)
file(APPEND ${CMAKE_BINARY_DIR}/CMakeOutput.log
"Checking to see if this platform supports large bit-fields (>32 bits) passed with "
"the following output:\n${OUTPUT}\n\n")
else(${VARIABLE})
else()
message(STATUS "Checking to see if this platform supports large bit-fields (>32 bits) - no")
file(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log
"Checking to see if this platform supports large bit-fields (>32 bits) failed with "
"the following output:\n${OUTPUT}\n\n")
endif(${VARIABLE})
endif("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
endmacro(CHECK_BIG_BITFIELD)
endif()
endif()
endmacro()
......@@ -20,11 +20,11 @@ macro(CHECK_CPP_DIRECTIVE_EXISTS DIRECTIVE VARIABLE)
file(APPEND ${CMAKE_BINARY_DIR}/CMakeOutput.log
"Checking to see if this platform supports has the ${DIRECTIVE} C-Preprocessor directive with "
"the following output:\n${OUTPUT}\n\n")
else(${VARIABLE})
else()
message(STATUS "Checking to see if this platform supports has the ${DIRECTIVE} C-Preprocessor directive - no")
file(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log
"Checking to see if this platform supports has the ${DIRECTIVE} C-Preprocessor directive with "
"the following output:\n${OUTPUT}\n\n")
endif(${VARIABLE})
endif("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
endmacro(CHECK_CPP_DIRECTIVE_EXISTS)
endif()
endif()
endmacro()
......@@ -10,15 +10,15 @@ macro(CHECK_CXX_SOURCE_RUNS_ARGS SOURCE_FILE ARGUMENT VAR)
if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
else(CMAKE_REQUIRED_LIBRARIES)
else()
set(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES)
endif(CMAKE_REQUIRED_LIBRARIES)
endif()
if(CMAKE_REQUIRED_INCLUDES)
set(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
else(CMAKE_REQUIRED_INCLUDES)
else()
set(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES)
endif(CMAKE_REQUIRED_INCLUDES)
endif()
message(STATUS "Performing Test ${VAR}")
try_run(${VAR}_EXITCODE ${VAR}_COMPILED
......@@ -35,7 +35,7 @@ macro(CHECK_CXX_SOURCE_RUNS_ARGS SOURCE_FILE ARGUMENT VAR)
# if it did not compile make the return value fail code of 1
if(NOT ${VAR}_COMPILED)
set(${VAR}_EXITCODE 1)
endif(NOT ${VAR}_COMPILED)
endif()
# if the return value was 0 then it worked
if("${${VAR}_EXITCODE}" EQUAL 0)
set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
......@@ -46,12 +46,12 @@ macro(CHECK_CXX_SOURCE_RUNS_ARGS SOURCE_FILE ARGUMENT VAR)
"Return value: ${${VAR}}\n"
"Argument: ${ARGUMENT}\n"
"Source file was: ${SOURCE_FILE}\n\n")
else("${${VAR}_EXITCODE}" EQUAL 0)
else()
if(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN")
set(${VAR} "${${VAR}_EXITCODE}")
else(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN")
else()
set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
endif(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN")
endif()
message(STATUS "Performing Test ${VAR} - Failed")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
......@@ -60,6 +60,6 @@ macro(CHECK_CXX_SOURCE_RUNS_ARGS SOURCE_FILE ARGUMENT VAR)
"Return value: ${${VAR}_EXITCODE}\n"
"Argument: ${ARGUMENT}\n"
"Source file was: ${SOURCE_FILE}\n\n")
endif("${${VAR}_EXITCODE}" EQUAL 0)
endif("${VAR}" MATCHES "^${VAR}$")
endmacro(CHECK_CXX_SOURCE_RUNS_ARGS)
endif()
endif()
endmacro()
......@@ -4,10 +4,10 @@ if(WIN32)
# do not build shared lib under windows
set(BUILD_SHARED_LIBS OFF)
message(STATUS "Disabling build shared lib option on windows like OS.")
else(WIN32)
else()
# on other systems, leave the choice to the user
option(BUILD_SHARED_LIBS "Build OTB with shared libraries." ON)
endif(WIN32)
endif()
set(OTB_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
......@@ -29,21 +29,21 @@ if(WIN32)
-D_CRT_VCCLRIT_NO_DEPRECATE
-D_SCL_SECURE_NO_DEPRECATE
)
endif(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
endif()
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_NONSTDC_NO_WARNING)
endif(MSVC)
endif()
endif(NOT MINGW)
endif(NOT CYGWIN)
endif(WIN32)
endif()
endif()
endif()
# __CYGWIN__ must be define for ossim (ex: ossimCommon.h, isnan definition, .. )
#if(CYGWIN)
# add_definitions(-D__CYGWIN__)
#endif(CYGWIN)
#endif()
# Large File Support (> 4Go)
......@@ -63,13 +63,13 @@ if(OTB_BUILD_PEDANTIC)
if(WIN32)
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif(MSVC)
else(WIN32)
endif()
else()
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
endif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
endif(WIN32)
endif(OTB_BUILD_PEDANTIC)
endif()
endif()
endif()
# Full compilation warning mode
......@@ -79,7 +79,7 @@ if(OTB_COMPILE_WITH_FULL_WARNING)
if(CMAKE_COMPILER_IS_GNUCXX)
set(OTB_FULL_WARNING_LIST_PARAMETERS "-Wall -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wuninitialized -Wsign-compare -Wparentheses -Wunknown-pragmas -Wswitch" CACHE STRING "List of compilation parameters.")
mark_as_advanced(OTB_FULL_WARNING_LIST_PARAMETERS)
endif(CMAKE_COMPILER_IS_GNUCXX)
endif(OTB_COMPILE_WITH_FULL_WARNING)
endif()
endif()
......@@ -36,20 +36,20 @@ macro(COMPARE_VERSION_STRINGS a_in b_in result_out)
set(shorter a)
math(EXPR range "${b_length} - 1")
math(EXPR pad_range "${b_length} - ${a_length} - 1")
else(a_length LESS b_length)
else()
# b is shorter
set(shorter b)
math(EXPR range "${a_length} - 1")
math(EXPR pad_range "${a_length} - ${b_length} - 1")
endif(a_length LESS b_length)
endif()
# PAD out if we need to
if(NOT pad_range LESS 0)
foreach(pad RANGE ${pad_range})
# Since shorter is an alias for b, we need to get to it by by dereferencing shorter.
list(APPEND ${shorter} 0)
endforeach(pad RANGE ${pad_range})
endif(NOT pad_range LESS 0)
endforeach()
endif()
set(result 0)
foreach(index RANGE ${range})
......@@ -60,14 +60,14 @@ macro(COMPARE_VERSION_STRINGS a_in b_in result_out)
# LESS
if(a_version LESS b_version)
set(result -1)
endif(a_version LESS b_version)
endif()
# GREATER
if(a_version GREATER b_version)
set(result 1)
endif(a_version GREATER b_version)
endif(result EQUAL 0)
endforeach(index)
endif()
endif()
endforeach()
# Copy out the return result
set(${result_out} ${result})
endmacro(COMPARE_VERSION_STRINGS)
endmacro()
......@@ -2,7 +2,7 @@
# ensure WIN32 definition
if(WIN32)
add_definitions(-DWIN32)
endif(WIN32)
endif()
# On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security
......@@ -26,8 +26,8 @@ if(WIN32)
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_NONSTDC_NO_WARNING)
endif(MSVC)
endif()
endif(NOT MINGW)
endif(NOT CYGWIN)
endif(WIN32)
endif()
endif()
endif()
......@@ -33,6 +33,6 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(EXPAT DEFAULT_MSG EXPAT_LIBRARY EXPAT_INCLUDE_
if(EXPAT_FOUND)
set(EXPAT_LIBRARIES ${EXPAT_LIBRARY})
set(EXPAT_INCLUDE_DIRS ${EXPAT_INCLUDE_DIR})
endif(EXPAT_FOUND)
endif()
mark_as_advanced(EXPAT_INCLUDE_DIR EXPAT_LIBRARY)
......@@ -51,22 +51,22 @@ if(WIN32)
if(NOT CYGWIN)
if(BORLAND)
set( FLTK_PLATFORM_DEPENDENT_LIBS import32 )
else(BORLAND)
else()
set( FLTK_PLATFORM_DEPENDENT_LIBS wsock32 comctl32 )
endif(BORLAND)
endif(NOT CYGWIN)
endif(WIN32)
endif()
endif()
endif()
if(UNIX)
include(FindX11)
find_library(FLTK_MATH_LIBRARY m)
mark_as_advanced(FLTK_MATH_LIBRARY)
set( FLTK_PLATFORM_DEPENDENT_LIBS ${X11_LIBRARIES} ${FLTK_MATH_LIBRARY})
endif(UNIX)
endif()
if(APPLE)
set( FLTK_PLATFORM_DEPENDENT_LIBS "-framework Carbon -framework Cocoa -framework ApplicationServices -lz")
endif(APPLE)
endif()
# If FLTK has been built using CMake we try to find everything directly (we support only case where
......@@ -78,16 +78,16 @@ if(NOT FLTK_DIR)
# Get the system search path as a list.
if(UNIX)
string(REGEX MATCHALL "[^:]+" FLTK_DIR_SEARCH1 "$ENV{PATH}")
else(UNIX)
else()
string(REGEX REPLACE "\\\\" "/" FLTK_DIR_SEARCH1 "$ENV{PATH}")
endif(UNIX)
endif()
string(REGEX REPLACE "/;" ";" FLTK_DIR_SEARCH2 ${FLTK_DIR_SEARCH1})
# Construct a set of paths relative to the system search path.
set(FLTK_DIR_SEARCH "")
foreach(dir ${FLTK_DIR_SEARCH2})
set(FLTK_DIR_SEARCH ${FLTK_DIR_SEARCH} "${dir}/../lib/fltk")
endforeach(dir)
endforeach()
#
# Look for an installation or build tree.
......@@ -126,12 +126,12 @@ if(NOT FLTK_DIR)
DOC "The ${FLTK_DIR_STRING}"
)
mark_as_advanced(FLTK_DIR)
endif(NOT FLTK_DIR)
endif()
# Check if FLTK was built using CMake
if(EXISTS ${FLTK_DIR}/FLTKConfig.cmake)
set(FLTK_BUILT_WITH_CMAKE 1)
endif(EXISTS ${FLTK_DIR}/FLTKConfig.cmake)
endif()
#message(STATUS "FLTK_BUILT_WITH_CMAKE= ${FLTK_BUILT_WITH_CMAKE}")
......@@ -171,7 +171,7 @@ if(FLTK_BUILT_WITH_CMAKE) # FLTK was build using CMak
FL FLTK_USE_SYSTEM_ZLIB
)
else(FLUID_COMMAND)
else()
# If fluid command is not available we try to use the 1.3.0 version
# Create the version string
......@@ -194,7 +194,7 @@ if(FLTK_BUILT_WITH_CMAKE) # FLTK was build using CMak
find_library(FLTK_FORMS_LIBRARY
NAMES fltkformsdll fltkformsdlld fltk_forms
PATHS ${FLTK_LIB_DIR})
else(BUILD_SHARED_LIBS)
else()
find_library(FLTK_BASE_LIBRARY
NAMES fltk fltkd
PATHS ${FLTK_LIB_DIR})
......@@ -207,26 +207,26 @@ if(FLTK_BUILT_WITH_CMAKE) # FLTK was build using CMak
find_library(FLTK_FORMS_LIBRARY
NAMES fltkforms fltkformsd fltk_forms
PATHS ${FLTK_LIB_DIR})
endif(BUILD_SHARED_LIBS)
endif()
endif(FLUID_COMMAND)
endif()
# Disable support for FLTK built with internal version of jpeg/png/zlib
# Those variable were not used further anyhow.
# set(FLTK_IMAGES_LIBS "")
# if(FLFLTK_USE_SYSTEM_JPEG)
# set(FLTK_IMAGES_LIBS ${FLTK_IMAGES_LIBS} fltk_jpeg)
# endif(FLFLTK_USE_SYSTEM_JPEG)
# endif()
# if(FLFLTK_USE_SYSTEM_PNG)
# set(FLTK_IMAGES_LIBS ${FLTK_IMAGES_LIBS} fltk_png)
# endif(FLFLTK_USE_SYSTEM_PNG)
# endif()
# if(FLFLTK_USE_SYSTEM_ZLIB)
# set(FLTK_IMAGES_LIBS ${FLTK_IMAGES_LIBS} fltk_zlib)
# endif(FLFLTK_USE_SYSTEM_ZLIB)
# endif()
# set(FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}" CACHE INTERNAL
# "Extra libraries for fltk_images library.")
else(FLTK_BUILT_WITH_CMAKE) # FLTK was not build using CMake
else() # FLTK was not build using CMake
# Find fluid executable.
find_program(FLTK_FLUID_EXECUTABLE fluid ${FLTK_INCLUDE_DIR}/fluid)
......@@ -241,7 +241,7 @@ else(FLTK_BUILT_WITH_CMAKE) # FLTK was not build using CMake
set(FLTK_LIBRARY_SEARCH_PATH ${FLTK_LIBRARY_SEARCH_PATH}
${FLTK_BIN_DIR}/../lib)
set(FLTK_WRAP_UI 1)
endif(FLTK_FLUID_EXECUTABLE)
endif()
#
# Try to find FLTK include dir using fltk-config
......@@ -259,7 +259,7 @@ else(FLTK_BUILT_WITH_CMAKE) # FLTK was not build using CMake
string(STRIP ${_dir} _output)
list(APPEND _FLTK_POSSIBLE_INCLUDE_DIRS ${_output})
endforeach()
endif(FLTK_CXXFLAGS)
endif()
endif()
endif()
endif()
......@@ -316,11 +316,11 @@ else(FLTK_BUILT_WITH_CMAKE) # FLTK was not build using CMake
# the file that originally included this module. Save the answer.
set(FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}" CACHE INTERNAL
"Extra libraries for fltk_images library.")
endif("${FLTK_IMAGES_LDFLAGS}" MATCHES "${FLTK_LIBS_EXTRACT_REGEX}")
endif(FLTK_CONFIG_SCRIPT)
endif(UNIX)
endif()
endif()
endif()
endif(FLTK_BUILT_WITH_CMAKE)
endif()
# Append all of the required libraries together (by default, everything)
set(FLTK_LIBRARIES)
......@@ -348,9 +348,9 @@ if(FLTK_FOUND)
if(APPLE)
set(FLTK_LIBRARIES ${FLTK_PLATFORM_DEPENDENT_LIBS} ${FLTK_LIBRARIES})
else(APPLE)
else()
set(FLTK_LIBRARIES ${FLTK_LIBRARIES} ${FLTK_PLATFORM_DEPENDENT_LIBS})
endif(APPLE)
endif()
set(FLTK_INCLUDE_DIRS ${FLTK_INCLUDE_DIR})
......@@ -359,7 +359,7 @@ if(FLTK_FOUND)
set(FLTK_INCLUDE_PATH ${FLTK_INCLUDE_DIR})
set(FLTK_FLUID_EXE ${FLTK_FLUID_EXECUTABLE})
set(FLTK_LIBRARY ${FLTK_LIBRARIES})
endif(FLTK_FOUND)
endif()
#message(STATUS "In (otb)FindFLTK.cmake FLTK_INCLUDE_DIR = ${FLTK_INCLUDE_DIR}")
#message(STATUS "In (otb)FindFLTK.cmake FLTK_LIBRARIES = ${FLTK_LIBRARIES}")
......
......@@ -41,7 +41,7 @@ macro(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg)
if(${_firstPoFile} STREQUAL "ALL")
set(_addToAll "ALL")
set(_firstPoFile)
endif(${_firstPoFile} STREQUAL "ALL")
endif()
foreach(_currentPoFile ${_firstPoFile} ${ARGN})
get_filename_component(_absFile ${_currentPoFile} ABSOLUTE)
......@@ -59,20 +59,20 @@ macro(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg)
install(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
set(_gmoFiles ${_gmoFiles} ${_gmoFile})
endforeach(_currentPoFile )
endforeach()
add_custom_target(translations ${_addToAll} DEPENDS ${_gmoFiles})
endmacro(GETTEXT_CREATE_TRANSLATIONS )
endmacro()
if(GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE )
set(GETTEXT_FOUND TRUE)
else(GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE )
else()
set(GETTEXT_FOUND FALSE)
if(GetText_REQUIRED)
message(FATAL_ERROR "GetText not found")
endif(GetText_REQUIRED)
endif(GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE )
endif()
endif()
......@@ -9,7 +9,7 @@
if( GETTEXT_INCLUDE_DIR )
# Already in cache, be silent
set( GETTEXT_FIND_QUIETLY TRUE )
endif( GETTEXT_INCLUDE_DIR )
endif()
find_path( GETTEXT_INCLUDE_DIR libintl.h )
......@@ -26,8 +26,8 @@ mark_as_advanced( GETTEXT_INCLUDE_DIR GETTEXT_LIBRARY )
if(GETTEXT_FOUND)
set(GETTEXT_INCLUDE_DIRS ${GETTEXT_INCLUDE_DIR})
set(GETTEXT_LIBRARIES ${GETTEXT_LIBRARY})
else(GETTEXT_FOUND)
else()
set(GETTEXT_INCLUDE_DIRS)
set(GETTEXT_LIBRARIES)
endif(GETTEXT_FOUND)
endif()
......@@ -9,7 +9,7 @@
if( ICUUC_INCLUDE_DIR )
# Already in cache, be silent
set( ICUUC_FIND_QUIETLY TRUE )
endif( ICUUC_INCLUDE_DIR )
endif()
find_path( ICUUC_INCLUDE_DIR unicode/unistr.h )
......@@ -26,8 +26,8 @@ mark_as_advanced( ICUUC_INCLUDE_DIR ICUUC_LIBRARY )
if(ICUUC_FOUND)
set(ICUUC_INCLUDE_DIRS ${ICUUC_INCLUDE_DIR})
set(ICUUC_LIBRARIES ${ICUUC_LIBRARY})
else(ICUUC_FOUND)
else()
set(ICUUC_INCLUDE_DIRS)
set(ICUUC_LIBRARIES)
endif(ICUUC_FOUND)
endif()
......@@ -59,15 +59,15 @@ macro(java_append_library_directories _var)
set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "s390" "s390x")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sh")
set(_java_libarch "sh")
else(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
else()
set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}")
endif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
endif()
# Append default list architectures if CMAKE_SYSTEM_PROCESSOR was empty or
# system is non-Linux (where the code above has not been well tested)
if(NOT _java_libarch OR NOT (CMAKE_SYSTEM_NAME MATCHES "Linux"))
list(APPEND _java_libarch "i386" "amd64" "ppc")
endif(NOT _java_libarch OR NOT (CMAKE_SYSTEM_NAME MATCHES "Linux"))
endif()
# Sometimes ${CMAKE_SYSTEM_PROCESSOR} is added to the list to prefer
# current value to a hardcoded list. Remove possible duplicates.
......@@ -78,12 +78,12 @@ macro(java_append_library_directories _var)
foreach(_libarch ${_java_libarch})
string(REPLACE "{libarch}" "${_libarch}" _newpath "${_path}")
list(APPEND ${_var} "${_newpath}")
endforeach(_libarch)
else(_path MATCHES "{libarch}")
endforeach()
else()
list(APPEND ${_var} "${_path}")
endif(_path MATCHES "{libarch}")
endforeach(_path)
endmacro(java_append_library_directories)
endif()
endforeach()
endmacro()
get_filename_component(java_install_version
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit;CurrentVersion]" NAME)
......@@ -136,7 +136,7 @@ foreach(dir ${JAVA_AWT_LIBRARY_DIRECTORIES})
"${dir}/client"
"${dir}/server"
)
endforeach(dir)
endforeach()
#//FIXME I removed this 3 paths from the JAVA_APPEND_LIBRARY_DIRECTORIES below
#"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include"
# "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include"
......@@ -171,43 +171,43 @@ foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}")
foreach(JAVA_INC_PATH ../include ../java/include ../share/java/include)
if(EXISTS ${jpath}/${JAVA_INC_PATH})
set(JAVA_AWT_INCLUDE_DIRECTORIES ${JAVA_AWT_INCLUDE_DIRECTORIES} "${jpath}/${JAVA_INC_PATH}")
endif(EXISTS ${jpath}/${JAVA_INC_PATH})
endforeach(JAVA_INC_PATH)
endif()
endforeach()
foreach(JAVA_LIB_PATH
../lib ../jre/lib ../jre/lib/i386
../java/lib ../java/jre/lib ../java/jre/lib/i386
../share/java/lib ../share/java/jre/lib ../share/java/jre/lib/i386)
if(EXISTS ${jpath}/${JAVA_LIB_PATH})
set(JAVA_AWT_LIBRARY_DIRECTORIES ${JAVA_AWT_LIBRARY_DIRECTORIES} "${jpath}/${JAVA_LIB_PATH}")
endif(EXISTS ${jpath}/${JAVA_LIB_PATH})
endforeach(JAVA_LIB_PATH)
endforeach(JAVA_PROG)
endif()
endforeach()
endforeach()
if(APPLE)
if(EXISTS ~/Library/Frameworks/JavaVM.framework)
set(JAVA_HAVE_FRAMEWORK 1)
endif(EXISTS ~/Library/Frameworks/JavaVM.framework)
endif()
if(EXISTS /Library/Frameworks/JavaVM.framework)
set(JAVA_HAVE_FRAMEWORK 1)
endif(EXISTS /Library/Frameworks/JavaVM.framework)
endif()
if(EXISTS /System/Library/Frameworks/JavaVM.framework)
set(JAVA_HAVE_FRAMEWORK 1)
endif(EXISTS /System/Library/Frameworks/JavaVM.framework)
endif()
if(JAVA_HAVE_FRAMEWORK)
if(NOT JAVA_AWT_LIBRARY)
set(JAVA_AWT_LIBRARY "-framework JavaVM" CACHE FILEPATH "Java Frameworks" FORCE)
endif(NOT JAVA_AWT_LIBRARY)
endif()
if(NOT JAVA_JVM_LIBRARY)
set(JAVA_JVM_LIBRARY "-framework JavaVM" CACHE FILEPATH "Java Frameworks" FORCE)
endif(NOT JAVA_JVM_LIBRARY)
endif()
if(NOT JAVA_AWT_INCLUDE_PATH)
if(EXISTS /System/Library/Frameworks/JavaVM.framework/Headers/jawt.h)
set(JAVA_AWT_INCLUDE_PATH "/System/Library/Frameworks/JavaVM.framework/Headers" CACHE FILEPATH "jawt.h location" FORCE)
endif(EXISTS /System/Library/Frameworks/JavaVM.framework/Headers/jawt.h)
endif(NOT JAVA_AWT_INCLUDE_PATH)
endif()
endif()
# If using "-framework JavaVM", prefer its headers *before* the others in
# JAVA_AWT_INCLUDE_DIRECTORIES... (*prepend* to the list here)
......@@ -218,15 +218,15 @@ if(APPLE)
/System/Library/Frameworks/JavaVM.framework/Headers
${JAVA_AWT_INCLUDE_DIRECTORIES}
)
endif(JAVA_HAVE_FRAMEWORK)
else(APPLE)
endif()
else()
find_library(JAVA_AWT_LIBRARY jawt
PATHS ${JAVA_AWT_LIBRARY_DIRECTORIES}
)
find_library(JAVA_JVM_LIBRARY NAMES jvm JavaVM
PATHS ${JAVA_JVM_LIBRARY_DIRECTORIES}
)
endif(APPLE)
endif()
# add in the include path
find_path(JAVA_INCLUDE_PATH jni.h
......
......@@ -9,7 +9,7 @@
if( LTDL_INCLUDE_DIR )
# Already in cache, be silent
set( LTDL_FIND_QUIETLY TRUE )
endif( LTDL_INCLUDE_DIR )
endif()
find_path( LTDL_INCLUDE_DIR ltdl.h )
......@@ -26,8 +26,8 @@ mark_as_advanced( LTDL_INCLUDE_DIR LTDL_LIBRARY )
if(LTDL_FOUND)
set(LTDL_INCLUDE_DIRS ${LTDL_INCLUDE_DIR})
set(LTDL_LIBRARIES ${LTDL_LIBRARY})
else(LTDL_FOUND)
else()
set(LTDL_INCLUDE_DIRS)
set(LTDL_LIBRARIES)
endif(LTDL_FOUND)
endif()
......@@ -9,7 +9,7 @@
if( LIBKML_INCLUDE_DIR )
# Already in cache, be silent
set( LibKML_FIND_QUIETLY TRUE )
endif( LIBKML_INCLUDE_DIR )
endif()
find_path( LIBKML_INCLUDE_DIR kml/dom.h )
......@@ -60,4 +60,4 @@ if(LIBKML_FOUND)
${LIBKML_REGIONATOR_LIBRARY}
${LIBKML_XSD_LIBRARY}
${LIBKML_MINIZIP_LIBRARY})
endif(LIBKML_FOUND)
endif()
......@@ -9,7 +9,7 @@
if( LIBLAS_INCLUDE_DIR )
# Already in cache, be silent
set( LIBLAS_FIND_QUIETLY TRUE )
endif( LIBLAS_INCLUDE_DIR )
endif()
find_path( LIBLAS_INCLUDE_DIR liblas/capi/liblas.h )
......@@ -26,8 +26,8 @@ mark_as_advanced( LIBLAS_INCLUDE_DIR LIBLAS_LIBRARY )
if(LIBLAS_FOUND)
set(LIBLAS_INCLUDE_DIRS ${LIBLAS_INCLUDE_DIR})
set(LIBLAS_LIBRARIES ${LIBLAS_LIBRARY})
else(LIBLAS_FOUND)
else()
set(LIBLAS_INCLUDE_DIRS)
set(LIBLAS_LIBRARIES)
endif(LIBLAS_FOUND)
endif()
......@@ -6,7 +6,7 @@
# Mercurial_WC_IDENTIFY(${PROJECT_SOURCE_DIR} Project)
# message("Current revision is ${Project_WC_REVISION}")
# message("Mercurial version is ${Mercurial_VERSION_HG}")
# endif(Mercurial_FOUND)
# endif()
set(Mercurial_FOUND FALSE)
......@@ -44,32 +44,32 @@ if(Mercurial_HG_EXECUTABLE)