CMakeLists.txt 14.3 KB
Newer Older
jcl's avatar
jcl committed
1
# ============================================================================
LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
2
# Copyright Jean-Charles LAMBERT - 2008-2018
jclamber's avatar
jclamber committed
3 4 5 6 7 8 9 10
#           Centre de donneeS Astrophysiques de Marseille (CeSAM)       
# e-mail:   Jean-Charles.Lambert@lam.fr                                      
# address:  Aix Marseille Universite, CNRS, LAM 
#           Laboratoire d'Astrophysique de Marseille                          
#           Pole de l'Etoile, site de Chateau-Gombert                         
#           38, rue Frederic Joliot-Curie                                     
#           13388 Marseille cedex 13 France                                   
#           CNRS UMR 7326    
jcl's avatar
jcl committed
11
# ============================================================================
jclamber's avatar
jclamber committed
12
# CMakeListst.txt file to compile UNSIO library
jcl's avatar
jcl committed
13
# ============================================================================
jclamber's avatar
jclamber committed
14

15
cmake_minimum_required(VERSION 2.8)
16

jcl's avatar
jcl committed
17
# project name
18
project (UNSIO2)
jclamber's avatar
jclamber committed
19 20


jcl's avatar
jcl committed
21
SET(CMAKE_VERBOSE_MAKEFILE OFF)
22
# extra cmake path
jclamber's avatar
jclamber committed
23 24 25 26
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)

# load setup flags
include(SetupFlags)
jcl's avatar
jcl committed
27

jclamber's avatar
jclamber committed
28 29
# Check fortran compiler
include(CheckFortranCompiler)
jclamber's avatar
jclamber committed
30

31 32 33 34 35 36 37
# use ccache if any
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
  set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
  set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)

38 39 40
# Cpack Generator detection
include(DetectCpackGenerator)

jclamber's avatar
jclamber committed
41 42 43 44 45 46 47 48 49 50 51 52
# contains the full path to the top level directory of your build tree
MESSAGE( STATUS "PROJECT_BINARY_DIR: " ${PROJECT_BINARY_DIR} )

# contains the full path to the root of your project source directory,
# i.e. to the nearest directory where CMakeLists.txt contains the PROJECT() command
MESSAGE( STATUS "PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR} )

MESSAGE( STATUS "CMAKE_BUILD_TYPE =" ${CMAKE_BUILD_TYPE} )
MESSAGE( STATUS "CMAKE_CXX_FLAGS  =" ${CMAKE_CXX_FLAGS} )
MESSAGE( STATUS "LIBRARY TYPE     =" ${LIBTYPE} )

MESSAGE( STATUS "core OPT  =" ${OPT} )
jclamber's avatar
jclamber committed
53 54
MESSAGE( STATUS "OSX detected =" ${OSX} )
MESSAGE( STATUS "BUILD_TYPE =" ${RELEASE} )
jclamber's avatar
jclamber committed
55

jcl's avatar
jcl committed
56
FIND_PACKAGE(SQLITE3)
57
if (APPLE)
58
#set (HDF5_USE_STATIC_LIBRARIES TRUE)
59 60
endif(APPLE)

Jcl's avatar
Jcl committed
61
FIND_PACKAGE(HDF5 COMPONENTS CXX REQUIRED)
LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
62
MESSAGE( STATUS "1) HDF5_CXX_LIBRARIES=" ${HDF5_CXX_LIBRARIES})
63

LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
64
if(LINUX_ISSUE MATCHES "Mageia")
65
#  SET(HDF5_CXX_LIBRARIES hdf5_hl_cpp.a hdf5_cpp.a hdf5.a) # use this trick to compile against hdf5 static libs, to keep compatibility between hdf5 libs, works only on mageia...
LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
66
endif()
67

LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
68
MESSAGE( STATUS "2) HDF5_CXX_LIBRARIES=" ${HDF5_CXX_LIBRARIES})
jcl's avatar
jcl committed
69

70
MESSAGE(STATUS "NEMO LIGHT will be build")
71

72 73
#add_subdirectory(${PROJECT_SOURCE_DIR}/3rdparty/nemolight  ${PROJECT_SOURCE_DIR}/3rdparty/nemolight/build-${CMAKE_BUILD_TYPE} )
add_subdirectory(${PROJECT_SOURCE_DIR}/3rdparty/nemolight)
74
set(NEMOLIGHT ${PROJECT_SOURCE_DIR}/3rdparty/nemolight)
75
set(NEMOLIB ${PROJECT_BINARY_DIR}/3rdparty/nemolight/lib)
76
set(NEMOINC ${NEMOLIGHT}/src/inc)
jcl's avatar
jcl committed
77 78

MESSAGE( STATUS "NEMOLIB : " ${NEMOLIB} )
79
MESSAGE( STATUS "NEMOINC : " ${NEMOINC} )
80
MESSAGE( STATUS "LIB_SUFFIX : " ${LIB_SUFFIX} )
jcl's avatar
jcl committed
81 82

# Find all the sources for the LIB
jclamber's avatar
jclamber committed
83
FILE(GLOB LIBSOURCES src/*.cc)
jcl's avatar
jcl committed
84 85

# Destination path for the lib
jclamber's avatar
jclamber committed
86
SET(LIBRARY_OUTPUT_PATH lib)
jcl's avatar
jcl committed
87 88

# compilation options
jclamber's avatar
jclamber committed
89

90 91 92 93
add_definitions(${OPT} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE ${DNOSQLITE3})
SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${WARNCPP} )
SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} ${WARNC} )
SET(CMAKE_Fortran_FLAGS ${CMAKE_Fortran_FLAGS} ${WARNF})
jcl's avatar
jcl committed
94

95 96 97
# remove -DNDEBUG in RElease mode to keep activated assert calls
STRING(REPLACE "-DNDEBUG" ""  CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})

jcl's avatar
jcl committed
98
# create library "uns"
99
add_library (unsio ${LIBTYPE} ${LIBSOURCES})
100
if (APPLE)
101 102 103 104 105 106 107 108 109
  if (NOT NO_RPATH) 
     MESSAGE(STATUS "RPATH activated for UNSIO library")
     SET_TARGET_PROPERTIES(unsio PROPERTIES MACOSX_RPATH TRUE) 
  else ()
     # to deactivate RPATH compile with -DNO_RPATH=1
     # it's mandatory to build wheel on MacOSX
     MESSAGE(STATUS "RPATH DE-activated for UNSIO library")
  endif()
  
110 111
endif (APPLE)

LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
112 113 114 115 116
# special flags for MacOSX
if (OSX)
  set(CMAKE_MACOSX_RPATH ON) 
endif()
#
117

118 119
SET(DEP_NEMO_LIB "nemo")
#ENDIF (NOT NEMO_INSTALLED)
120

LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
121
target_link_libraries(unsio ${DEP_NEMO_LIB} ${HDF5_CXX_LIBRARIES} sqlite3 z )
LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
122 123 124
if (OSX)
    set_target_properties(unsio PROPERTIES LINK_FLAGS "-undefined suppress -flat_namespace")
endif()
jcl's avatar
jcl committed
125

jclamber's avatar
jclamber committed
126 127 128 129 130 131
# ----------------------------------------------------------
# Install SETUP
# ----------------------------------------------------------

mark_as_advanced(CMAKE_INSTALL_PREFIX)

132 133 134 135 136
SET(PREFIX_LIB ${LIB_SUFFIX})
SET(PREFIX_INC "include")
SET(PREFIX_MAN "share/man")
SET(PREFIX_SCR "share/uns/scripts")

jclamber's avatar
jclamber committed
137
IF (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
138
  set   (CMAKE_INSTALL_PREFIX "$ENV{HOME}/local/unsio" CACHE PATH "" FORCE)  #if NEMO NOT exist => default install into ${HOME}/local/unsio
jclamber's avatar
jclamber committed
139 140 141
ENDIF ()#NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

MESSAGE( STATUS "--------> CMAKE_INSTALL_PREFIX =" ${CMAKE_INSTALL_PREFIX})
142 143

# following line is important for building python wheel package later from docker ci
144
if (NOT OSX)
145
set_target_properties(unsio PROPERTIES LINK_FLAGS "-Wl,-rpath=${CMAKE_INSTALL_PREFIX}/${PREFIX_LIB}")
146
endif()
147

jclamber's avatar
jclamber committed
148
if (OSX)
149 150
  #MESSAGE(STATUS "\nAfter running \"make install\", do not forget to set your environment variable DYLD_LIBRARY_PATH using command:\n\n export DYLD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib\n")
  MESSAGE(STATUS "\nBetter run cmake on macosx using clang compiler with commnand:\nCC=/usr/bin/cc CXX=/usr/bin/c++ cmake ..\n")
jclamber's avatar
jclamber committed
151
endif(OSX)
jclamber's avatar
jclamber committed
152 153 154 155 156 157 158

# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

159
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${PREFIX_LIB}")
jclamber's avatar
jclamber committed
160 161 162 163 164 165

# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# the RPATH to be used when installing, but only if it's not a system directory
166
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${PREFIX_LIB}" isSystemDir)
jclamber's avatar
jclamber committed
167
IF("${isSystemDir}" STREQUAL "-1")
168
   SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${PREFIX_LIB}")
jclamber's avatar
jclamber committed
169 170 171 172
ENDIF("${isSystemDir}" STREQUAL "-1")


# ----------------------------------------------------------
jcl's avatar
jcl committed
173
# Executbale output path
jclamber's avatar
jclamber committed
174
set(EXECUTABLE_OUTPUT_PATH bin)
jcl's avatar
jcl committed
175 176 177
MESSAGE( STATUS "EXECUTABLE_OUTPUT_PATH: " ${EXECUTABLE_OUTPUT_PATH} )

# Make sure the compiler can find include files from our Hello library.
178
include_directories (${UNSIO2_SOURCE_DIR}/src ${NEMOINC} ${NEMOLIB} ${SQLITE3_H_PATH})
179
include_directories (/usr/include/malloc ${HDF5_INCLUDE_DIRS})
jcl's avatar
jcl committed
180 181

# Make sure the linker can find the Hello library once it is built.
182 183
link_directories (${UNSIO2_BINARY_DIR}/lib /usr/X11/lib ${SQLITE3_LIB_PATH} )
link_directories ( ${NEMOLIB} ${FC_GFORT_PATH} ${FC_G77_PATH} )
jcl's avatar
jcl committed
184 185

# Find all LIB's sources files
jclamber's avatar
jclamber committed
186
FILE(GLOB exe_sources test_src/*.F)
jcl's avatar
jcl committed
187 188 189


# ----------------------------------------------------------
jclamber's avatar
jclamber committed
190
# compile CC programs
jcl's avatar
jcl committed
191
# Find all LIB's sources files
jclamber's avatar
jclamber committed
192
FILE(GLOB execpp_sources test_src/*.cc)
jcl's avatar
jcl committed
193 194 195 196 197 198 199

# build cpp executables according to the source
FOREACH(exe_cpp ${execpp_sources})

  get_filename_component(exe ${exe_cpp} NAME_WE)
  MESSAGE( STATUS "New executable ==> " ${exe})
  add_executable (${exe} ${exe_cpp})
200 201 202
  if (APPLE)
     SET_TARGET_PROPERTIES(${exe} PROPERTIES MACOSX_RPATH TRUE) 
     SET_TARGET_PROPERTIES(${exe} PROPERTIES CMAKE_INSTALL_NAME_DIR "@rpath") 
203
     #SET_TARGET_PROPERTIES(${exe} PROPERTIES INSTALL_RPATH "@rpath/../lib") 
204
  endif(APPLE)
jcl's avatar
jcl committed
205
  # Link the executable to the Hello library.
206
  target_link_libraries (${exe} unsio ) # ${FC_GFORT_LIB} ${FC_G77_LIB} stdc++)
jclamber's avatar
jclamber committed
207 208 209
  IF (${exe} STREQUAL "uns_info")
    INSTALL(TARGETS ${exe} RUNTIME  DESTINATION bin)
  ENDIF()
jcl's avatar
jcl committed
210 211 212 213 214

ENDFOREACH(exe_cpp ${execpp_sources})

# build Fortran executables according to the source
# compilation options
215
if (CMAKE_Fortran_COMPILER)
jclamber's avatar
jclamber committed
216

jcl's avatar
jcl committed
217 218 219 220 221 222 223 224
FOREACH(exe_f ${exe_sources})

  get_filename_component(exe ${exe_f} NAME_WE)
  MESSAGE( STATUS "New executable ==> " ${exe})
  add_executable (${exe} ${exe_f})

  # Link the executable to the Hello library.
  #target_link_libraries (${exe} unsio nemomaing77 nemo g2c sqlite3 stdc++)
Jcl's avatar
Jcl committed
225
  target_link_libraries (${exe} unsio nemomaing77 ${FC_LIB} stdc++)
jcl's avatar
jcl committed
226 227 228 229 230

  SET_TARGET_PROPERTIES(${exe} PROPERTIES LINKER_LANGUAGE Fortran)
  # add "-lstdc++"
  #SET(CMAKE_Fortran_LINK_FLAGS "-L${NEMOLIB} ") #-lstdc++")
ENDFOREACH(exe_f ${exe_sources})
231
endif()
jclamber's avatar
jclamber committed
232 233 234 235


# ----------------------------------------------------------
# Install procedure
jcl's avatar
jcl committed
236 237
# ----------------------------------------------------------
  
jclamber's avatar
jclamber committed
238
# UNS specific includes
239 240 241 242 243 244 245
INSTALL(FILES  ${UNSIO2_SOURCE_DIR}/src/uns.h DESTINATION ${PREFIX_INC}/uns)
INSTALL(FILES  ${UNSIO2_SOURCE_DIR}/src/version.h DESTINATION ${PREFIX_INC}/uns)
INSTALL(FILES  ${UNSIO2_SOURCE_DIR}/src/unsdebug.h DESTINATION ${PREFIX_INC}/uns)
INSTALL(FILES  ${UNSIO2_SOURCE_DIR}/src/snapshotinterface.h DESTINATION ${PREFIX_INC}/uns)
INSTALL(FILES  ${UNSIO2_SOURCE_DIR}/src/componentrange.h DESTINATION ${PREFIX_INC}/uns)
INSTALL(FILES  ${UNSIO2_SOURCE_DIR}/src/ctools.h DESTINATION ${PREFIX_INC}/uns)
INSTALL(FILES  ${UNSIO2_SOURCE_DIR}/src/userselection.h DESTINATION ${PREFIX_INC}/uns)
246 247 248
# unsio lib
INSTALL(FILES  ${UNSIO2_BINARY_DIR}/lib/libunsio.${LIBEXT} DESTINATION ${PREFIX_LIB})
# man
249
INSTALL(FILES  ${UNSIO2_SOURCE_DIR}/man/man3/unsiof.3 DESTINATION ${PREFIX_MAN}/man3)
jclamber's avatar
jclamber committed
250

251 252 253
#
# NEMO specific lib and includes 
#
jclamber's avatar
jclamber committed
254

255 256
#INSTALL(FILES  ${NEMOLIB}/libnemo.a DESTINATION ${PREFIX_LIB})
INSTALL(FILES  ${NEMOLIB}/libnemomaing77.a DESTINATION ${PREFIX_LIB})
jclamber's avatar
jclamber committed
257

258 259 260 261 262
# Find all NEMOLIGHT header files
FILE(GLOB nlight_files ${NEMOLIGHT}/src/*.h ${NEMOLIGHT}/src/inc/*.h)
FOREACH(source_header ${nlight_files})
  INSTALL(FILES  ${source_header} DESTINATION ${PREFIX_INC}/nemo)
ENDFOREACH()
jclamber's avatar
jclamber committed
263

264 265 266 267
FILE(GLOB nlight_files ${NEMOLIGHT}/src/inc/snapshot/*.c ${NEMOLIGHT}/src/inc/snapshot/*.h)
FOREACH(source_header ${nlight_files})
  INSTALL(FILES  ${source_header} DESTINATION ${PREFIX_INC}/nemo/snapshot)
ENDFOREACH()
jclamber's avatar
jclamber committed
268 269


270 271 272 273 274 275

if (NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr")
  # I man using this hack otherwise the RPM package created fails to install because an unresolve dependency on Tools::Sqlite3 
  # module though which comes with this install....
  
  # install sqlite3 database files
276 277 278 279
  INSTALL(FILES  ${UNSIO2_SOURCE_DIR}/scripts/perl/lib/Tools/Tools.pm DESTINATION "${PREFIX_SCR}/perl/lib/Tools")
  INSTALL(FILES  ${UNSIO2_SOURCE_DIR}/scripts/perl/lib/Tools/Sqlite3.pm DESTINATION "${PREFIX_SCR}/perl/lib/Tools")
  INSTALL(FILES  ${UNSIO2_SOURCE_DIR}/scripts/sql/create_unsio_db.sql DESTINATION "${PREFIX_SCR}/sql")
  INSTALL(FILES  ${UNSIO2_SOURCE_DIR}/scripts/sql/README DESTINATION "${PREFIX_SCR}/sql")
280 281

  # some binaries
282 283 284 285
  INSTALL(PROGRAMS  ${UNSIO2_SOURCE_DIR}/scripts/perl/mains/unsio_sql3_get_info.pl DESTINATION bin)
  INSTALL(PROGRAMS  ${UNSIO2_SOURCE_DIR}/scripts/perl/mains/unsio_sql3_update_info.pl DESTINATION bin)
  INSTALL(PROGRAMS  ${UNSIO2_SOURCE_DIR}/scripts/perl/mains/unsio_sql3_update_nemorange.pl DESTINATION bin)
  INSTALL(PROGRAMS  ${UNSIO2_SOURCE_DIR}/scripts/perl/mains/unsio_sql3_create_db.pl DESTINATION bin)
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331
endif()

# ----------
# PACKAGING
# ----------
# VERSION
if (EXISTS "${PROJECT_SOURCE_DIR}/src/version.h") # detect version from "version.h" file
  set(CURRENT_VERSION "")
  file(READ "${PROJECT_SOURCE_DIR}/src/version.h" CURRENT_VERSION_H)

  # UNSIO_MAJOR
  string(REGEX MATCH "UNSIO_MAJOR \"([a-zA-Z0-9.-]+)\"" XXXX "${CURRENT_VERSION_H}")
  set(PROJECT_VERSION_MAJOR ${CMAKE_MATCH_1})

  # UNSIO_MINOR
  string(REGEX MATCH "UNSIO_MINOR \"([a-zA-Z0-9.-]+)\"" XXXX "${CURRENT_VERSION_H}")
  set(PROJECT_VERSION_MINOR ${CMAKE_MATCH_1})

  #  UNSIO_PATCH
  string(REGEX MATCH "UNSIO_PATCH \"([a-zA-Z0-9.-]+)\"" XXXX "${CURRENT_VERSION_H}")
  set(PROJECT_VERSION_PATCH ${CMAKE_MATCH_1})

  # UNSIO_EXTRA
  string(REGEX MATCH "UNSIO_EXTRA \"([_a-zA-Z0-9.-]+)\"" XXXX "${CURRENT_VERSION_H}")
  set(PROJECT_VERSION_EXTRA ${CMAKE_MATCH_1})

  # PROJECT_VERSION
  set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${PROJECT_VERSION_EXTRA}")

  message(STATUS "Project Version = " ${PROJECT_VERSION})
endif()

# CPACK infos
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_NAME "unsio")
set(CPACK_PACKAGE_RELEASE 1)
set(CPACK_PACKAGE_CONTACT "Jean-Charles LAMBERT")
set(CPACK_PACKAGE_VENDOR "LAM - CeSAM")
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${LINUX_NAME}.${CMAKE_SYSTEM_PROCESSOR}")
#set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${LINUX_NAME}.${CMAKE_SYSTEM_PROCESSOR}")

# CPACK RPM specific
set(CPACK_RPM_CHANGELOG_FILE "${PROJECT_SOURCE_DIR}/ChangeLog")
set(CPACK_RPM_PACKAGE_LICENSE "CeCILL2")
set(CPACK_RPM_PACKAGE_DESCRIPTION "UNSIO - Universal Nbody Snapshot Input Output")
332
set(CPACK_RPM_PACKAGE_PROVIDES "libunsio.so()(64bit)")
333 334 335 336

# CPACK debian specific
set(CPACK_DEBIAN_PACKAGE_NAME ${CPACK_PACKAGE_NAME})
set(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${LINUX_NAME})
337 338
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON)
339 340 341 342 343 344
IF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
  SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64)
ELSEIF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686")
  SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
ENDIF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_RPM_PACKAGE_DESCRIPTION})
345
set(CPACK_DEBIAN_PACKAGE_PROVIDES "unsio, libunsio")
346 347

if (APPLE)
348 349 350
  #set(CMAKE_INSTALL_PREFIX "/Applications")
  #set(CMAKE_INSTALL_PREFIX "/")
  #set(CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK ON)
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375
  set(CPACK_GENERATOR "DragNDrop")
  set(CPACK_DMG_FORMAT "UDBZ")
  set(CPACK_DMG_VOLUME_NAME "${PROJECT_NAME}")
  set(CPACK_SYSTEM_NAME "OSX")
  set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
 #set(CPACK_PACKAGE_ICON "${ICONS_DIR}/DMG.icns")
  #set(CPACK_DMG_DS_STORE "${ICONS_DIR}/DMGDSStore")
  #set(CPACK_DMG_BACKGROUND_IMAGE "${ICONS_DIR}/DMGBackground.png")
endif()

if (NOT WIN32)
  #SET(CPACK_STRIP_FILES {CMAKE_INSTALL_PREFIX}/bin/glnemo2)
  #SET(CPACK_STRIP_FILES "True")
  #SET(CPACK_SET_DESTDIR On)
        set(CMAKE_INSTALL_DO_STRIP TRUE)
  #SET(CPACK_INSTALL_PREFIX "/usr")
  #SET(CMAKE_INSTALL_PREFIX ${CPACK_INSTALL_PREFIX})
endif()

set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION "${BIN_INSTALL_DIR}")
include(InstallRequiredSystemLibraries)

# This must always be last!
include(CPack)