Commit fdce529d authored by Rashad Kanavath's avatar Rashad Kanavath

BUG: SuperBuild: fix ossim build on windows

parent 32ff73f2
......@@ -72,18 +72,33 @@ else()
DEPENDS ${${proj}_DEPENDENCIES}
)
if(MSVC)
ExternalProject_Add_Step(${proj} patch_ossim_src
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/patches/ossim/src ${OSSIM_SB_SRC}/ossim/src
DEPENDEES patch_ossim_include
DEPENDERS configure )
if(WIN32)
if(MSVC)
ExternalProject_Add_Step(${proj} patch_ossim_src
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/patches/ossim/src ${OSSIM_SB_SRC}/ossim/src
DEPENDEES patch_ossim_include
DEPENDERS configure )
ExternalProject_Add_Step(${proj} patch_ossim_include
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/patches/ossim/include ${OSSIM_SB_SRC}/ossim/include
ExternalProject_Add_Step(${proj} patch_ossim_include
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/patches/ossim/include ${OSSIM_SB_SRC}/ossim/include
DEPENDEES patch_ossim_cmake1
DEPENDERS patch_ossim_src )
endif()
ExternalProject_Add_Step(${proj} patch_ossim_cmake1
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/patches/ossim/CMakeLists.txt ${OSSIM_SB_SRC}/ossim/
DEPENDEES patch_ossim_cmake2
DEPENDERS patch_ossim_include )
ExternalProject_Add_Step(${proj} patch_ossim_cmake2
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/patches/ossim/OssimUtilities.cmake ${OSSIM_SB_SRC}/ossim_package_support/cmake/CMakeModules
DEPENDEES patch
DEPENDERS patch_ossim_src )
DEPENDERS patch_ossim_cmake1 )
endif()
set(_SB_${proj}_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include)
......
PROJECT(ossimcore)
Message("################## Setting up OSSIM core library #########################")
IF(NOT OSSIM_BUILD_ADDITIONAL_OSSIM_DIRECTORIES)
SET(OSSIM_BUILD_ADDITIONAL_OSSIM_DIRECTORIES "" CACHE PATH "Specify full paths separated by ; to additional OSSIM applications you wish to include into the ossim build framework. These will have variables setup for the ossim includes" FORCE)
ENDIF(NOT OSSIM_BUILD_ADDITIONAL_OSSIM_DIRECTORIES)
cmake_minimum_required(VERSION 2.8)
SET(CMAKE_MODULE_PATH "${${PROJECT_NAME}_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
INCLUDE(OssimVersion)
INCLUDE(OssimCommonVariables)
# Expose some build options
OPTION(BUILD_OSSIM_FREETYPE_SUPPORT "Set to ON to build OSSIM with freetype support. Use OFF to turn off freetype support." ON)
OPTION(BUILD_OSSIM_MPI_SUPPORT "Set to ON to build OSSIM with MPI support. Use OFF to turn off MPI support." ON)
OPTION(BUILD_OSSIM_ID_SUPPORT "Set to ON to build OSSIM SVN ID support into the library. Use OFF to turn off ID support." ON)
OPTION(BUILD_OSSIM_APPS "Set to ON to build ossim apps. Use OFF to disable." ON)
OPTION(BUILD_OSSIM_CURL_APPS "Set to ON to build ossim curl dependent apps. Use ON to enable." OFF)
OPTION(BUILD_OSSIM_TEST_APPS "Set to ON to build ossim test apps. Use OFF to disable." ON)
OPTION(BUILD_OSSIM_APPS "Set to ON to build ossim test apps. Use OFF to disable." ON)
###################################################################################
# Include the Utilities in the root make
###################################################################################
INCLUDE(OssimUtilities)
INCLUDE(CheckIncludeFile)
CHECK_INCLUDE_FILE("dirent.h" CMAKE_HAVE_DIRENT_H)
CHECK_INCLUDE_FILE("unistd.h" CMAKE_HAVE_UNISTD_H)
CHECK_INCLUDE_FILE("getopt.h" CMAKE_HAVE_GETOPT_H)
CHECK_INCLUDE_FILE("fcntl.h" CMAKE_HAVE_FCNTL_H)
CHECK_INCLUDE_FILE("dbmalloc.h" CMAKE_HAVE_DBMALLOC_H)
CHECK_INCLUDE_FILE("malloc.h" CMAKE_HAVE_MALLOC_H)
CHECK_INCLUDE_FILE("dlfcn.h" CMAKE_HAVE_DLFCN_H)
# Set our include paths:
include_directories( ${PROJECT_SOURCE_DIR}/include )
include_directories( ${PROJECT_BINARY_DIR}/include )
# Stores list of libs to link with. Initialized throughout.
set( ossimDependentLibs )
#---
# Find required and optional packages and add their include paths and libraries:
#---
# GEOS - Currently optional until it is actually called.:
find_package( GEOS )
if( GEOS_FOUND )
include_directories( ${GEOS_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${GEOS_LIBRARY} )
else( GEOS_FOUND )
message( FATAL_ERROR "Could not find geos package! Consider installing this as it will soon become a required package." )
endif( GEOS_FOUND )
# GEOFIFF - Required:
set( OSSIM_HAS_GEOTIFF 0 )
find_package( GEOTIFF )
if( GEOTIFF_FOUND )
include_directories( ${GEOTIFF_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${GEOTIFF_LIBRARY} )
set( OSSIM_HAS_GEOTIFF 1 )
else( GEOTIFF_FOUND )
message( FATAL_ERROR "Could not find required geotiff package!" )
endif( GEOTIFF_FOUND )
# GEOTRANS - Required: (GeoTrans 3.4.x port future...)
# find_package( Geotrans )
# if( GEOTRANS_FOUND )
# include_directories( ${GEOTRANS_INCLUDE_DIR} )
# set( ossimDependentLibs ${ossimDependentLibs} ${GEOTRANS_LIBRARY} )
# else( GEOTRANS_FOUND )
# message( FATAL_ERROR "Could not find required geotrans package!" )
# endif( GEOTRANS_FOUND )
# JPEG - Required package:
find_package( JPEG )
if( JPEG_FOUND )
include_directories( ${JPEG_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${JPEG_LIBRARY} )
else( JPEG_FOUND )
message( FATAL_ERROR "Could not find required jpeg package!" )
endif( JPEG_FOUND )
# OpenThreads - Required:
find_package( OpenThreads )
if( OPENTHREADS_FOUND )
include_directories( ${OPENTHREADS_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${OPENTHREADS_LIBRARY} )
else( OPENTHREADS_FOUND )
message( FATAL_ERROR "Could not find required OpenThreads package!" )
endif( OPENTHREADS_FOUND )
# TIFF - Required:
find_package( TIFF )
if( TIFF_FOUND )
include_directories( ${TIFF_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${TIFF_LIBRARY} )
else( TIFF_FOUND )
message( FATAL_ERROR "Could not find required tiff package!" )
endif( TIFF_FOUND )
# DL - Required on unix:
if( UNIX )
find_library( DL_LIBRARY dl )
if ( DL_LIBRARY )
set( ossimDependentLibs ${ossimDependentLibs} ${DL_LIBRARY} )
else( DL_LIBRARY )
# TODO: Is this required on unix? If so move to the required section.
message( FATAL_ERROR "Could not find dl library!" )
endif( DL_LIBRARY )
endif( UNIX )
# FREETYPE - Optional:
set( OSSIM_HAS_FREETYPE 0 )
if( BUILD_OSSIM_FREETYPE_SUPPORT )
find_package(Freetype)
if( FREETYPE_FOUND )
include_directories( ${FREETYPE_INCLUDE_DIRS} )
set( ossimDependentLibs ${ossimDependentLibs} ${FREETYPE_LIBRARIES} )
set( OSSIM_HAS_FREETYPE 1 )
else( FREETYPE_FOUND )
message( WARNING "Could not find optional freetype package!" )
endif( FREETYPE_FOUND )
endif( BUILD_OSSIM_FREETYPE_SUPPORT )
# MPI - Optional:
set( OSSIM_HAS_MPI 0 )
if( BUILD_OSSIM_MPI_SUPPORT )
find_package(MPI)
if ( MPI_FOUND )
include_directories( ${MPI_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${MPI_LIBRARY} )
set( OSSIM_HAS_MPI 1 )
else ( MPI_FOUND )
message( WARNING "Could not find optional MPI package!" )
endif ( MPI_FOUND )
endif( BUILD_OSSIM_MPI_SUPPORT )
# ZLIB - Optional:
set( OSSIM_HAS_LIBZ 0 )
find_package( ZLIB )
if ( ZLIB_FOUND )
include_directories( ${ZLIB_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${ZLIB_LIBRARY} )
set( OSSIM_HAS_LIBZ 1 )
else ( ZLIB_FOUND )
message( WARNING "Could not find optional zlib package!" )
endif ( ZLIB_FOUND )
#---
# Call the OSSIM macros in OssimUtilities.cmake
#---
TODAYS_DATE(OSSIM_BUILD_DATE)
SET(OSSIM_SVN_REVISION_NUMBER "UNKNOWN")
GET_SVN_REVISION()
if ( NOT ${Project_WC_REVISION} EQUAL 0 )
set( OSSIM_SVN_REVISION_NUMBER ${Project_WC_REVISION} )
endif()
#####################################################################################
# Call the configure files for ossimConfig and ossimVersion setup
#####################################################################################
set(OSSIM_VERSION_NUMBER "\"${OSSIM_VERSION}\"")
set(OSSIM_BUILD_DATE "\"${OSSIM_BUILD_DATE}\"")
set(OSSIM_REVISION_NUMBER "\"${OSSIM_SVN_REVISION_NUMBER}\"")
# Setting of OSSIM_ID to variable expanded $Id$ results. Embedded troughout code.
set(OSSIM_ID_ENABLED 1)
IF(NOT BUILD_OSSIM_ID_SUPPORT)
set(OSSIM_ID_ENABLED 0)
ENDIF(NOT BUILD_OSSIM_ID_SUPPORT)
SET(OSSIM_CONFIGURE_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/ossim/ossimConfig.h")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/ossim/ossimConfig.h.in"
"${OSSIM_CONFIGURE_HEADER}")
SET(OSSIM_VERSION_HEADER_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/src/ossim/ossimVersion.h.in")
SET(OSSIM_VERSION_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/ossim/ossimVersion.h")
CONFIGURE_FILE("${OSSIM_VERSION_HEADER_CONFIG}"
"${OSSIM_VERSION_HEADER}")
##################################################################################################
# Instead of creating another CMakeLists under src we will just add the subdirectories to build
# here
##################################################################################################
subdirs(src/ossim)
#---
# Building apps optional.
#---
if(BUILD_OSSIM_APPS)
subdirs(src/apps)
endif()
#---
# Building curl dependant apps optional. default=OFF
#---
if(BUILD_OSSIM_CURL_APPS)
subdirs(src/apps/curl_apps)
endif()
#---
# Building test apps optional.
#---
if(BUILD_OSSIM_TEST_APPS)
subdirs(src/test)
endif()
set(TARGET_COMMON_LIBRARIES ossim ${OPENTHREADS_LIBRARY})
##################################################################################################
#
# Setup install destinations for the shared files:
# 1) Projection CSV files:
#
##################################################################################################
FILE(GLOB ossim_projection_codes_csv ${${PROJECT_NAME}_SOURCE_DIR}/share/ossim/projection/*.csv ${${PROJECT_NAME}_SOURCE_DIR}/share/ossim/projection/*.txt)
INSTALL(FILES ${ossim_projection_codes_csv} DESTINATION share/ossim/projection COMPONENT ossim)
# 2) Utility API JSON files
FILE(GLOB ossim_util_api_json ${${PROJECT_NAME}_SOURCE_DIR}/share/ossim/util/*.json)
INSTALL(FILES ${ossim_util_api_json} DESTINATION share/ossim/util COMPONENT ossim)
###################### OUTPUT GENERAL VARIABLE SETTINGS #######################
MESSAGE( STATUS "OSSIM_REVISION_NUMBER = ${OSSIM_REVISION_NUMBER}" )
MESSAGE( STATUS "BUILD_LIBRARY_DIR = ${BUILD_LIBRARY_DIR}" )
MESSAGE( STATUS "BUILD_RUNTIME_DIR = ${BUILD_RUNTIME_DIR}" )
MESSAGE( STATUS "BUILD_OSSIM_FREETYPE_SUPPORT = ${BUILD_OSSIM_FREETYPE_SUPPORT}" )
MESSAGE( STATUS "BUILD_OSSIM_APPS = ${BUILD_OSSIM_APPS}" )
MESSAGE( STATUS "BUILD_OSSIM_CURL_APPS = ${BUILD_OSSIM_CURL_APPS}" )
MESSAGE( STATUS "BUILD_OSSIM_TEST_APPS = ${BUILD_OSSIM_TEST_APPS}" )
MESSAGE( STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}" )
MESSAGE( STATUS "CMAKE_CXX_COMPILER = ${CMAKE_CXX_COMPILER}" )
MESSAGE( STATUS "CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}" )
MESSAGE( STATUS "CMAKE_CXX_FLAGS_DEBUG = ${CMAKE_CXX_FLAGS_DEBUG}" )
MESSAGE( STATUS "CMAKE_CXX_FLAGS_RELEASE = ${CMAKE_CXX_FLAGS_RELEASE}" )
MESSAGE( STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" )
MESSAGE( STATUS "FREETYPE_LIBRARY = ${FREETYPE_LIBRARIES}" )
MESSAGE( STATUS "FREETYPE_INCLUDE = ${FREETYPE_INCLUDE_DIRS}" )
MESSAGE( STATUS "GEOTIFF_LIBRARY = ${GEOTIFF_LIBRARIES}" )
MESSAGE( STATUS "GEOTIFF_INCLUDE = ${GEOTIFF_INCLUDE_DIR}" )
MESSAGE( STATUS "GEOTRANS_LIBRARY = ${GEOTRANS_LIBRARY}" )
MESSAGE( STATUS "GEOTRANS_INCLUDE = ${GEOTRANS_INCLUDE_DIR}" )
MESSAGE( STATUS "GEOS_LIBRARY = ${GEOS_LIBRARY}" )
MESSAGE( STATUS "GEOS_INCLUDE = ${GEOS_INCLUDE_DIR}" )
MESSAGE( STATUS "JPEG_LIBRARY = ${JPEG_LIBRARIES}" )
MESSAGE( STATUS "JPEG_INCLUDE = ${JPEG_INCLUDE_DIR}" )
MESSAGE( STATUS "MPI_LIBRARY = ${MPI_LIBRARIES}" )
MESSAGE( STATUS "MPI_INCLUDE = ${MPI_INCLUDE_PATH}" )
MESSAGE( STATUS "OPENTHREADS_LIBRARY = ${OPENTHREADS_LIBRARY}" )
MESSAGE( STATUS "OPENTHREADS_INCLUDE = ${OPENTHREADS_INCLUDE_DIR}" )
MESSAGE( STATUS "OSSIM_COMPILE_WITH_FULL_WARNING = ${OSSIM_COMPILE_WITH_FULL_WARNING}" )
MESSAGE( STATUS "OSSIM DEPENDENT LIBRARIES = ${ossimDependentLibs}" )
MESSAGE( STATUS "TIFF_LIBRARY = ${TIFF_LIBRARIES}" )
MESSAGE( STATUS "TIFF_INCLUDE = ${TIFF_INCLUDE_DIR}" )
MESSAGE( STATUS "ZLIB_LIBRARY = ${ZLIB_LIBRARIES}" )
MESSAGE( STATUS "ZLIB_INCLUDE = ${ZLIB_INCLUDE_DIR}" )
#-----------------------------------------------------------------------------
# uninstall target
#-----------------------------------------------------------------------------
OSSIM_ADD_COMMON_MAKE_UNINSTALL()
message("################## end of OSSIM core library setup #########################")
#################################################################################
# This was taken from the http://www.cmake.org/Wiki/CMakeMacroParseArguments
#################################################################################
MACRO(OSSIM_PARSE_ARGUMENTS prefix arg_names option_names)
SET(DEFAULT_ARGS)
FOREACH(arg_name ${arg_names})
SET(${prefix}_${arg_name})
ENDFOREACH(arg_name)
FOREACH(option ${option_names})
SET(${prefix}_${option} FALSE)
ENDFOREACH(option)
SET(current_arg_name DEFAULT_ARGS)
SET(current_arg_list)
FOREACH(arg ${ARGN})
SET(larg_names ${arg_names})
LIST(FIND larg_names "${arg}" is_arg_name)
IF (is_arg_name GREATER -1)
SET(${prefix}_${current_arg_name} ${current_arg_list})
SET(current_arg_name ${arg})
SET(current_arg_list)
ELSE (is_arg_name GREATER -1)
SET(loption_names ${option_names})
LIST(FIND loption_names "${arg}" is_option)
IF (is_option GREATER -1)
SET(${prefix}_${arg} TRUE)
ELSE (is_option GREATER -1)
SET(current_arg_list ${current_arg_list} ${arg})
ENDIF (is_option GREATER -1)
ENDIF (is_arg_name GREATER -1)
ENDFOREACH(arg)
SET(${prefix}_${current_arg_name} ${current_arg_list})
ENDMACRO(OSSIM_PARSE_ARGUMENTS)
##############################################################################################
# This was taken from http://www.cmake.org/Wiki/CMakeMacroListOperations#CAR_and_CDR
##############################################################################################
MACRO(OSSIM_CAR var)
SET(${var} ${ARGV1})
ENDMACRO(OSSIM_CAR)
#############################################################################################
# This was taken from http://www.cmake.org/Wiki/CMakeMacroListOperations#CAR_and_CDR
#############################################################################################
MACRO(OSSIM_CDR var junk)
SET(${var} ${ARGN})
ENDMACRO(OSSIM_CDR)
#################################################################################
# MACRO: TODAYS_DATE
#
# DESCRIPTION:
# MACRO FOR GETTING THE DATE AND TIME INFORMATION
#################################################################################
MACRO (TODAYS_DATE RESULT)
string(TIMESTAMP ${RESULT} "%Y%m%d" UTC)
ENDMACRO ()
#################################################################################
# MACRO: GET_SVN_REVISION
#
# DESCRIPTION:
# MACRO FOR GETTING THE SVN revision for this build
#################################################################################
MACRO (GET_SVN_REVISION)
FIND_PACKAGE(Subversion)
IF(SUBVERSION_FOUND)
Subversion_WC_INFO(${PROJECT_SOURCE_DIR} Project)
# MESSAGE("Current revision is ${Project_WC_REVISION}")
# Subversion_WC_LOG(${PROJECT_SOURCE_DIR} Project)
# MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}")
ENDIF()
ENDMACRO(GET_SVN_REVISION)
MACRO(LINK_EXTERNAL TRGTNAME)
FOREACH(LINKLIB ${ARGN})
TARGET_LINK_LIBRARIES(${TRGTNAME} "${LINKLIB}" )
ENDFOREACH(LINKLIB)
ENDMACRO(LINK_EXTERNAL TRGTNAME)
MACRO(LINK_INTERNAL TRGTNAME)
IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
TARGET_LINK_LIBRARIES(${TRGTNAME} ${ARGN})
ELSE(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
FOREACH(LINKLIB ${ARGN})
IF(MSVC AND OSSIM_MSVC_VERSIONED_DLL)
#when using versioned names, the .dll name differ from .lib name, there is a problem with that:
#CMake 2.4.7, at least seem to use PREFIX instead of IMPORT_PREFIX for computing linkage info to use into projects,
# so we full path name to specify linkage, this prevent automatic inferencing of dependencies, so we add explicit depemdencies
#to library targets used
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${OUTPUT_LIBDIR}/${LINKLIB}${CMAKE_RELEASE_POSTFIX}.lib" debug "${OUTPUT_LIBDIR}/${LINKLIB}${CMAKE_DEBUG_POSTFIX}.lib")
ADD_DEPENDENCIES(${TRGTNAME} ${LINKLIB})
ELSE(MSVC AND OSSIM_MSVC_VERSIONED_DLL)
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${LINKLIB}${CMAKE_RELEASE_POSTFIX}" debug "${LINKLIB}${CMAKE_DEBUG_POSTFIX}")
ENDIF(MSVC AND OSSIM_MSVC_VERSIONED_DLL)
ENDFOREACH(LINKLIB)
ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
ENDMACRO(LINK_INTERNAL TRGTNAME)
######################################################################
#
# This set up the libraries to link to, it assumes there are two variable: one common for a group of examples or plugins
# kept in the variable TARGET_COMMON_LIBRARIES and an example or plugin specific kept in TARGET_ADDED_LIBRARIES
# they are combined in a single list checked for unicity
# the suffix ${CMAKE_DEBUG_POSTFIX} is used for differentiating optimized and debug
#
# a second variable TARGET_EXTERNAL_LIBRARIES hold the list of libraries not differentiated between debug and optimized
##################################################################################
MACRO(SETUP_LINK_LIBRARIES)
SET(TARGET_LIBRARIES ${TARGET_COMMON_LIBRARIES})
FOREACH(LINKLIB ${TARGET_ADDED_LIBRARIES})
SET(TO_INSERT TRUE)
FOREACH (value ${TARGET_COMMON_LIBRARIES})
IF (${value} STREQUAL ${LINKLIB})
SET(TO_INSERT FALSE)
ENDIF (${value} STREQUAL ${LINKLIB})
ENDFOREACH (value ${TARGET_COMMON_LIBRARIES})
IF(TO_INSERT)
LIST(APPEND TARGET_LIBRARIES ${LINKLIB})
ENDIF(TO_INSERT)
ENDFOREACH(LINKLIB)
LINK_INTERNAL(${TARGET_TARGETNAME} ${TARGET_LIBRARIES})
TARGET_LINK_LIBRARIES(${TARGET_TARGETNAME} ${TARGET_EXTERNAL_LIBRARIES})
IF(TARGET_LIBRARIES_VARS)
LINK_WITH_VARIABLES(${TARGET_TARGETNAME} ${TARGET_LIBRARIES_VARS})
ENDIF(TARGET_LIBRARIES_VARS)
ENDMACRO(SETUP_LINK_LIBRARIES)
MACRO(OSSIM_SETUP_APPLICATION)
OSSIM_PARSE_ARGUMENTS(APPLICATION
"COMPONENT_NAME;SOURCE_FILES;HEADERS;TARGET_NAME;TARGET_LABEL"
"COMMAND_LINE;INSTALL;REQUIRE_WINMAIN_FLAG"
${ARGN})
OSSIM_CAR(APPLICATION_NAME "${APPLICATION_DEFAULT_ARGS}")
OSSIM_CDR(APPLICATION_SOURCES "${APPLICATION_DEFAULT_ARGS}")
SET(TARGET_NAME ${APPLICATION_NAME})
SET(TARGET_TARGETNAME "${TARGET_DEFAULT_PREFIX}${APPLICATION_NAME}")
IF(APPLICATION_TARGET_NAME)
set(TARGET_TARGETNAME "${APPLICATION_TARGET_NAME}")
ENDIF(APPLICATION_TARGET_NAME)
SET(TARGET_LABEL "${TARGET_DEFAULT_LABEL_PREFIX} ${APPLICATION_NAME}")
IF(APPLICATION_TARGET_LABEL)
SET(TARGET_LABEL "${APPLICATION_TARGET_LABEL}")
ENDIF(APPLICATION_TARGET_LABEL)
IF(APPLICATION_COMMAND_LINE)
ADD_EXECUTABLE(${TARGET_TARGETNAME} ${APPLICATION_SOURCE_FILES} ${APPLICATION_HEADERS})
ELSE(APPLICATION_COMMAND_LINE)
IF(APPLE)
# SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${OSSIM_MAJOR_VERSION}.${OSSIM_MINOR_VERSION}.${OSSIM_PATCH_VERSION}")
# Short Version is the "marketing version". It is the version
# the user sees in an information panel.
SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${OSSIM_MAJOR_VERSION}.${OSSIM_MINOR_VERSION}.${OSSIM_PATCH_VERSION}")
# Bundle version is the version the OS looks at.
SET(MACOSX_BUNDLE_BUNDLE_VERSION "${OSSIM_MAJOR_VERSION}.${OSSIM_MINOR_VERSION}.${OSSIM_PATCH_VERSION}")
SET(MACOSX_BUNDLE_GUI_IDENTIFIER "org.ossim.${TARGET_TARGETNAME}" )
SET(MACOSX_BUNDLE_BUNDLE_NAME "${TARGET_TARGETNAME}" )
# SET(MACOSX_BUNDLE_ICON_FILE "myicon.icns")
# SET(MACOSX_BUNDLE_COPYRIGHT "")
# SET(MACOSX_BUNDLE_INFO_STRING "Info string, localized?")
ENDIF(APPLE)
IF(WIN32)
IF (APPLICATION_REQUIRE_WINMAIN_FLAG)
SET(PLATFORM_SPECIFIC_CONTROL WIN32)
ENDIF (APPLICATION_REQUIRE_WINMAIN_FLAG)
ENDIF(WIN32)
IF(APPLE)
IF(OSSIM_BUILD_APPLICATION_BUNDLES)
SET(PLATFORM_SPECIFIC_CONTROL MACOSX_BUNDLE)
ENDIF(OSSIM_BUILD_APPLICATION_BUNDLES)
ENDIF(APPLE)
ADD_EXECUTABLE(${TARGET_TARGETNAME} ${PLATFORM_SPECIFIC_CONTROL} ${APPLICATION_SOURCE_FILES} ${APPLICATION_HEADERS})
ENDIF(APPLICATION_COMMAND_LINE)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES OUTPUT_NAME ${TARGET_NAME})
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_OUTPUT_NAME "${TARGET_NAME}${CMAKE_DEBUG_POSTFIX}")
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES RELEASE_OUTPUT_NAME "${TARGET_NAME}${CMAKE_RELEASE_POSTFIX}")
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES RELWITHDEBINFO_OUTPUT_NAME "${TARGET_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}")
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES MINSIZEREL_OUTPUT_NAME "${TARGET_NAME}${CMAKE_MINSIZEREL_POSTFIX}")
IF(MSVC_IDE AND OSSIM_MSVC_VERSIONED_DLL)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../")
ENDIF(MSVC_IDE AND OSSIM_MSVC_VERSIONED_DLL)
SETUP_LINK_LIBRARIES()
IF(APPLICATION_INSTALL)
IF(APPLE)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} BUNDLE DESTINATION ${INSTALL_RUNTIME_DIR} COMPONENT ${APPLICATION_COMPONENT_NAME})
ELSE(APPLE)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} ${INSTALL_COMPONENT_INFO} COMPONENT ${APPLICATION_COMPONENT_NAME})
ENDIF(APPLE)
ENDIF(APPLICATION_INSTALL)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BUILD_RUNTIME_DIR}")
ENDMACRO(OSSIM_SETUP_APPLICATION)
#####################################################################################################
# MACRO: OSSIM_LINK_LIBRARY
#
# Example:
# OSSIM_LINK_LIBRARY(ossim
# COMPONENT_NAME ossim
# SOURCE_FILES foo.cpp
# HEADERS foo.h
# TYPE SHARED
# LIBRARIES <list of libraries to link against>
# INSTALL_LIB
# INSTALL_HEADERS)
#
# The INSTALL_LIB says to add a default install command for the library by default it will setup the following
# install(TARGETS ossim
# FRAMEWORK DESTINATION ${INSTALL_FRAMEWORK_DIR}
# RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR}
# LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
# ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR}
# PUBLIC_HEADER DESTINATION ${INSTALL_INCLUDE_DIR}
# COMPONENT ossim)
#
# The INSTALL_HEADERS will do a default header installation if the option is passed in
# install(FILES <list of headers> DESTINATION "include/ossim" COMPONENT ossim)
#####################################################################################################
MACRO(OSSIM_LINK_LIBRARY)
# The SO_VERSION and VERSION are here for override purpose only so other libraries with their own
# versioning scheme can use the sum linking
#
OSSIM_PARSE_ARGUMENTS(LINK
"COMPONENT_NAME;SOURCE_FILES;HEADERS;TYPE;LIBRARIES;ADDITIONAL_COMPILE_FLAGS;SOVERSION;VERSION;PUBLIC_HEADERS"
"INSTALL_LIB;INSTALL_HEADERS;VERSION_SYMLINKS"
${ARGN})
OSSIM_CAR(LINK_NAME "${LINK_DEFAULT_ARGS}")
OSSIM_CDR(LINK_SOURCES "${LINK_DEFAULT_ARGS}")
ADD_DEFINITIONS("${OSSIM_COMMON_COMPILER_FLAGS}")
ADD_LIBRARY(${LINK_NAME}
${LINK_TYPE}
${LINK_HEADERS}
${LINK_SOURCE_FILES})
IF(NOT LINK_PUBLIC_HEADERS)
SET(LINK_PUBLIC_HEADERS ${LINK_HEADERS})
ENDIF()
IF(LINK_ADDITIONAL_COMPILE_FLAGS)
SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
COMPILE_FLAGS ${LINK_ADDITIONAL_COMPILE_FLAGS})
ENDIF(LINK_ADDITIONAL_COMPILE_FLAGS)
if(APPLE)
IF(BUILD_SHARED_LIBS)
# SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
# SET(CMAKE_INSTALL_RPATH "${OSSIM_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR}")
IF(BUILD_OSSIM_FRAMEWORKS)
SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
FRAMEWORK TRUE
BUILD_WITH_INSTALL_RPATH ON
INSTALL_NAME_DIR @executable_path/../Frameworks)
ELSE(BUILD_OSSIM_FRAMEWORKS)
SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
FRAMEWORK FALSE
BUILD_WITH_INSTALL_RPATH ON
INSTALL_NAME_DIR @executable_path/../lib)
ENDIF(BUILD_OSSIM_FRAMEWORKS)
ELSE(BUILD_SHARED_LIBRARY)
SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
FRAMEWORK FALSE)
ENDIF(BUILD_SHARED_LIBS)
ENDIF(APPLE)
IF(UNIX AND BUILD_SHARED_LIBS AND NOT APPLE)
IF(LINK_VERSION_SYMLINKS)
IF(NOT LINK_SOVERSION)
set(LINK_SOVERSION "${OSSIM_SOVERSION}")
ENDIF(NOT LINK_SOVERSION)
IF(NOT LINK_VERSION)
set(LINK_VERSION "${OSSIM_VERSION}")
ENDIF(NOT LINK_VERSION)
# ADD_CUSTOM_TARGET( lib DEPENDS ${LINK_NAME} )
# change lib_target properties
SET_TARGET_PROPERTIES( ${LINK_NAME} PROPERTIES
# create *nix style library versions + symbolic links
VERSION ${LINK_VERSION}
SOVERSION ${LINK_SOVERSION}
# allow creating static and shared libs without conflicts
CLEAN_DIRECT_OUTPUT 1
# avoid conflicts between library and binary target names
OUTPUT_NAME ${LINK_NAME} )
ENDIF(LINK_VERSION_SYMLINKS)
ENDIF(UNIX AND BUILD_SHARED_LIBS AND NOT APPLE)
SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BUILD_RUNTIME_DIR}")
IF(APPLE AND BUILD_OSSIM_FRAMEWORKS)
SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BUILD_FRAMEWORK_DIR}")
ELSE(APPLE AND BUILD_OSSIM_FRAMEWORKS)
SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BUILD_LIBRARY_DIR}")
ENDIF(APPLE AND BUILD_OSSIM_FRAMEWORKS)
SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BUILD_LIBRARY_DIR}")
TARGET_LINK_LIBRARIES(${LINK_NAME} ${LINK_LIBRARIES} ${${LINK_NAME}_EXTRA_LIBS})
IF(LINK_INSTALL_LIB)
IF(LINK_INSTALL_HEADERS)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PUBLIC_HEADER "${LINK_PUBLIC_HEADERS}")
install(TARGETS ${LINK_NAME}
FRAMEWORK DESTINATION ${INSTALL_FRAMEWORK_DIR} COMPONENT ${LINK_COMPONENT_NAME}
RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} COMPONENT ${LINK_COMPONENT_NAME}
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} COMPONENT ${LINK_COMPONENT_NAME}
ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR} COMPONENT ${LINK_COMPONENT_NAME}-dev
PUBLIC_HEADER DESTINATION ${INSTALL_INCLUDE_DIR} COMPONENT ${LINK_COMPONENT_NAME}-dev)
ELSE(LINK_INSTALL_HEADERS)
install(TARGETS ${LINK_NAME}
FRAMEWORK DESTINATION ${INSTALL_FRAMEWORK_DIR} COMPONENT ${LINK_COMPONENT_NAME}
RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} COMPONENT ${LINK_COMPONENT_NAME}
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} COMPONENT ${LINK_COMPONENT_NAME}
ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR} COMPONENT ${LINK_COMPONENT_NAME}-dev)
ENDIF(LINK_INSTALL_HEADERS)
ENDIF(LINK_INSTALL_LIB)
ENDMACRO(OSSIM_LINK_LIBRARY)
MACRO(OSSIM_ADD_COMMON_MAKE_UNINSTALL)
# get_target_property(TEST_UNINSTALL uninstall CREATED)
# IF(NOT TEST_UNINSTALL)
#-----------------------------------------------------------------------------
### uninstall target
#-----------------------------------------------------------------------------
SET(OSSIM_CMAKE_UNINSTALL_CONFIG "${PROJECT_SOURCE_DIR}/CMakeModules/cmake_uninstall.cmake.in")
IF(EXISTS ${OSSIM_CMAKE_UNINSTALL_CONFIG})
CONFIGURE_FILE(
"${OSSIM_CMAKE_UNINSTALL_CONFIG}"
"${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
)
set_target_properties(uninstall PROPERTIES CREATED 1)
ENDIF(EXISTS ${OSSIM_CMAKE_UNINSTALL_CONFIG})
# ENDIF(NOT TEST_UNINSTALL)
ENDMACRO(OSSIM_ADD_COMMON_MAKE_UNINSTALL)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment