Changeset 4849


Ignore:
Timestamp:
02/26/09 11:23:11 (11 years ago)
Author:
curtis
Message:

Remove hardcoded paths and other improvements, courtesy of Zack Galbreath.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/native/itk-plugin/CMakeLists.txt

    r4843 r4849  
    3232cmake_minimum_required(VERSION 2.4) 
    3333if(COMMAND cmake_policy) 
    34   cmake_policy(SET CMP0003 NEW) 
     34 cmake_policy(SET CMP0003 NEW) 
    3535endif(COMMAND cmake_policy) 
    3636 
     
    3939 
    4040if(NOT DEFINED BUILD_SHARED_LIBS) 
    41   option(BUILD_SHARED_LIBS "Build with shared libraries." ON) 
     41 option(BUILD_SHARED_LIBS "Build with shared libraries." ON) 
    4242endif(NOT DEFINED BUILD_SHARED_LIBS) 
    4343 
     
    4545# Include dirs 
    4646 
    47 #TEMP: 
    48 set(JACE_DIR /home/curtis/svn/jace) 
    49 set(BF_JACE_DIR /home/curtis/svn/java/components/native/bf-cpp) 
     47set(JACE_DIR NOTFOUND CACHE PATH "The path to toplevel directory of your Jace checkout") 
     48if(NOT JACE_DIR) 
     49 message(FATAL_ERROR "Please set JACE_DIR to the toplevel directory of your Jace checkout") 
     50endif() 
     51 
     52set(BF_JACE_DIR ${PROJECT_SOURCE_DIR}/../bf-cpp) 
     53 
     54find_package(JNI REQUIRED) 
    5055 
    5156set(include_dirs 
    52   ${CMAKE_CURRENT_SOURCE_DIR} 
    53   ${CMAKE_CURRENT_BINARY_DIR} 
     57 ${CMAKE_CURRENT_SOURCE_DIR} 
     58 ${CMAKE_CURRENT_BINARY_DIR} 
     59 ${JNI_INCLUDE_DIRS} 
    5460#CTR 
    55   ${JACE_DIR}/source/c++/include 
    56   ${BF_JACE_DIR}/include 
    57   ${BF_JACE_DIR}/proxies/include 
    58   ) 
     61 ${JACE_DIR}/source/c++/include 
     62 ${BF_JACE_DIR}/include 
     63 ${BF_JACE_DIR}/proxies/include 
     64 ) 
    5965 
    6066#if(EXISTS "${ITK_DIR}/CMakeCache.txt") 
     
    6975 
    7076configure_file( 
    71   ${CMAKE_CURRENT_SOURCE_DIR}/itkBioFormatsImageIOConfigure.h.in 
    72   ${CMAKE_CURRENT_BINARY_DIR}/itkBioFormatsImageIOConfigure.h 
    73   ) 
     77 ${CMAKE_CURRENT_SOURCE_DIR}/itkBioFormatsImageIOConfigure.h.in 
     78 ${CMAKE_CURRENT_BINARY_DIR}/itkBioFormatsImageIOConfigure.h 
     79 ) 
    7480 
    7581file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 
    7682install(FILES 
    77   ${headers} 
    78   "${CMAKE_CURRENT_BINARY_DIR}/itkBioFormatsImageIOConfigure.h" 
    79   DESTINATION include/${PROJECT_NAME} COMPONENT Development 
    80   ) 
     83 ${headers} 
     84 "${CMAKE_CURRENT_BINARY_DIR}/itkBioFormatsImageIOConfigure.h" 
     85 DESTINATION include/${PROJECT_NAME} COMPONENT Development 
     86 ) 
    8187 
    8288# -------------------------------------------------------------------------- 
     
    8490 
    8591set(BioFormatsImageIO_SRCS 
    86   itkBioFormatsImageIO.cxx 
    87   itkBioFormatsImageIOFactory.cxx 
    88   ) 
     92 itkBioFormatsImageIO.cxx 
     93 itkBioFormatsImageIOFactory.cxx 
     94 ) 
    8995 
    9096# -------------------------------------------------------------------------- 
     
    9399set(lib_name BioFormatsIO) 
    94100add_library(${lib_name} 
    95   ${BioFormatsImageIO_SRCS} 
    96   ) 
     101 ${BioFormatsImageIO_SRCS} 
     102 ) 
    97103 
    98104target_link_libraries(${lib_name} 
    99   ITKIO 
     105 ITKIO 
    100106#CTR 
    101   jace 
    102   bfjace 
     107 jace 
     108 bfjace 
    103109) 
    104110 
    105111install(TARGETS ${lib_name} 
    106   RUNTIME DESTINATION bin COMPONENT RuntimeLibraries 
    107   LIBRARY DESTINATION lib/${PROJECT_NAME} COMPONENT RuntimeLibraries 
    108   ARCHIVE DESTINATION lib/${PROJECT_NAME} COMPONENT Development 
     112 RUNTIME DESTINATION bin COMPONENT RuntimeLibraries 
     113 LIBRARY DESTINATION lib/${PROJECT_NAME} COMPONENT RuntimeLibraries 
     114 ARCHIVE DESTINATION lib/${PROJECT_NAME} COMPONENT Development 
    109115) 
    110116 
     
    116122 
    117123if(NOT DEFINED BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR) 
    118   set(BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR lib/ITKFactories) 
     124 set(BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR lib/ITKFactories) 
    119125endif(NOT DEFINED BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR) 
    120126 
    121127add_library(BioFormatsIOPlugin SHARED 
    122   itkBioFormatsIOPlugin.cxx 
    123   ) 
     128 itkBioFormatsIOPlugin.cxx 
     129 ) 
    124130set_target_properties(BioFormatsIOPlugin 
    125   PROPERTIES 
    126   RUNTIME_OUTPUT_DIRECTORY 
    127   "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}" 
    128   LIBRARY_OUTPUT_DIRECTORY 
    129   "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}" 
    130   ARCHIVE_OUTPUT_DIRECTORY 
    131   "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}" 
    132   ) 
     131 PROPERTIES 
     132 RUNTIME_OUTPUT_DIRECTORY 
     133 "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}" 
     134 LIBRARY_OUTPUT_DIRECTORY 
     135 "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}" 
     136 ARCHIVE_OUTPUT_DIRECTORY 
     137 "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}" 
     138 ) 
    133139target_link_libraries(BioFormatsIOPlugin 
    134   ${lib_name} 
     140 ${lib_name} 
    135141#CTR 
    136   jace 
    137   bfjace 
     142 jace 
     143 bfjace 
    138144) 
    139145 
    140146install(TARGETS BioFormatsIOPlugin 
    141   RUNTIME DESTINATION ${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR} COMPONENT RuntimeLibraries 
    142   LIBRARY DESTINATION ${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR} COMPONENT RuntimeLibraries 
    143   ARCHIVE DESTINATION lib/${PROJECT_NAME} COMPONENT Development 
    144   ) 
     147 RUNTIME DESTINATION ${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR} COMPONENT RuntimeLibraries 
     148 LIBRARY DESTINATION ${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR} COMPONENT RuntimeLibraries 
     149 ARCHIVE DESTINATION lib/${PROJECT_NAME} COMPONENT Development 
     150 ) 
    145151 
    146152# make a copy named '.so' for compatibility with the expectations 
     
    148154 
    149155if(APPLE) 
    150   add_custom_command( 
    151     TARGET BioFormatsIOPlugin 
    152     DEPENDS "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}/libBioFormatsIOPlugin.dylib" 
    153     POST_BUILD 
    154     COMMAND ${CMAKE_COMMAND} -E copy 
    155     "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}/libBioFormatsIOPlugin.dylib" 
    156     "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}/libBioFormatsIOPlugin.so" 
    157     VERBATIM 
    158     ) 
    159   install(FILES 
    160     "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}/libBioFormatsIOPlugin.so" 
    161     DESTINATION ${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR} 
    162     ) 
     156 add_custom_command( 
     157   TARGET BioFormatsIOPlugin 
     158   DEPENDS "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}/libBioFormatsIOPlugin.dylib" 
     159   POST_BUILD 
     160   COMMAND ${CMAKE_COMMAND} -E copy 
     161   "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}/libBioFormatsIOPlugin.dylib" 
     162   "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}/libBioFormatsIOPlugin.so" 
     163   VERBATIM 
     164   ) 
     165 install(FILES 
     166   "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}/libBioFormatsIOPlugin.so" 
     167   DESTINATION ${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR} 
     168   ) 
    163169endif(APPLE) 
Note: See TracChangeset for help on using the changeset viewer.