Ticket #23420: patch-src-CMakeLists.txt.diff

File patch-src-CMakeLists.txt.diff, 2.5 KB (added by davidm@…, 15 years ago)
  • src/CMakeLists.txt

    old new  
    11project(qhull_lib)
    22
     3# Configurable items here.
     4
     5option(USE_RPATH "Use -rpath when linking libraries, executables" ON)
     6
     7# libraries are all shared by default
     8option(BUILD_SHARED_LIBS "Build shared libraries" ON)
     9
     10# Change before each release whenever there has been an API change of any
     11# kind.
     12set(qhull_SOVERSION 5)
     13set(qhull_VERSION ${qhull_SOVERSION}.0.0)
     14
    315# Order object files by frequency of execution.  Small files at end.
    416set(
    517    qhull_src
     
    2234)
    2335
    2436file(GLOB qhull_hdr *.h)
     37install(FILES ${qhull_hdr} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/qhull)
     38
    2539
    2640add_library(qhull ${qhull_src})
    2741target_link_libraries(qhull m)
     42set_target_properties(
     43  qhull
     44  PROPERTIES
     45  SOVERSION ${qhull_SOVERSION}
     46  VERSION ${qhull_VERSION}
     47  INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib
     48  )
     49install(TARGETS qhull DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
     50
    2851
    2952set(qhullcmd_SOURCES  unix.c)
    3053set(rbox_SOURCES  rbox.c)
     
    3356set(qvoronoi_SOURCES  qvoronoi.c)
    3457set(qhalf_SOURCES  qhalf.c)
    3558
     59set(TARGET_LIST)
     60list(APPEND TARGET_LIST qhullcmd)
     61list(APPEND TARGET_LIST rbox)
     62list(APPEND TARGET_LIST qconvex)
     63list(APPEND TARGET_LIST qdelaunay)
     64list(APPEND TARGET_LIST qvoronoi)
     65list(APPEND TARGET_LIST qhalf)
     66
     67foreach(TARGET ${TARGET_LIST})
     68  add_executable(${TARGET} ${${TARGET}_SOURCES})
     69  target_link_libraries(${TARGET} qhull)
     70  if(USE_RPATH)
     71    set_target_properties(
     72      ${TARGET}
     73      PROPERTIES
     74      INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib
     75      INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/bin
     76      )
     77  else(USE_RPATH)
     78    set_target_properties(
     79      ${TARGET}
     80      PROPERTIES
     81      INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/bin
     82      )
     83  endif(USE_RPATH)
     84  install(TARGETS ${TARGET} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
     85endforeach(TARGET ${TARGET_LIST})
    3686
    37 add_executable(qhullcmd ${qhullcmd_SOURCES})
    38 target_link_libraries(qhullcmd qhull)
    39 
    40 add_executable(rbox ${rbox_SOURCES})
    41 target_link_libraries(rbox qhull)
    42 
    43 add_executable(qconvex ${qconvex_SOURCES})
    44 target_link_libraries(qconvex qhull)
    45 
    46 add_executable(qdelaunay ${qdelaunay_SOURCES})
    47 target_link_libraries(qdelaunay qhull)
    48 
    49 add_executable(qvoronoi ${qvoronoi_SOURCES})
    50 target_link_libraries(qvoronoi qhull)
    51 
    52 add_executable(qhalf ${qhalf_SOURCES})
    53 target_link_libraries(qhalf qhull)
    54 
     87set_target_properties(qhullcmd PROPERTIES OUTPUT_NAME qhull)