CMakeLists.txt
author Balazs Dezso <deba@google.com>
Wed, 17 Oct 2018 17:52:11 +0200
changeset 1182 6b79d93e812f
parent 1137 ca4e4a5e9b6e
child 1185 c8d0179a32a2
child 1197 f179aa1045a4
permissions -rw-r--r--
Planar drawing algorithm now works for less than 3 nodes (#611)
alpar@1107
     1
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
alpar@225
     2
alpar@1119
     3
IF(POLICY CMP0048) 
alpar@1119
     4
  CMAKE_POLICY(SET CMP0048 OLD) 
alpar@1119
     5
ENDIF(POLICY CMP0048)
alpar@1114
     6
alpar@1137
     7
IF(POLICY CMP0026)
alpar@1137
     8
  #This is for copying the dll's needed by glpk (in lp_test and mip_test)
alpar@1137
     9
  CMAKE_POLICY(SET CMP0026 OLD) 
alpar@1137
    10
ENDIF(POLICY CMP0026)
alpar@1137
    11
ladanyi@678
    12
SET(PROJECT_NAME "LEMON")
ladanyi@678
    13
PROJECT(${PROJECT_NAME})
alpar@225
    14
alpar@927
    15
INCLUDE(FindPythonInterp)
alpar@927
    16
INCLUDE(FindWget)
alpar@927
    17
ladanyi@678
    18
IF(EXISTS ${PROJECT_SOURCE_DIR}/cmake/version.cmake)
ladanyi@678
    19
  INCLUDE(${PROJECT_SOURCE_DIR}/cmake/version.cmake)
ladanyi@678
    20
ELSEIF(DEFINED ENV{LEMON_VERSION})
ladanyi@678
    21
  SET(LEMON_VERSION $ENV{LEMON_VERSION} CACHE STRING "LEMON version string.")
ladanyi@678
    22
ELSE()
ladanyi@678
    23
  EXECUTE_PROCESS(
alpar@982
    24
    COMMAND
alpar@982
    25
    hg log -r. --template "{latesttag}"
alpar@927
    26
    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
alpar@982
    27
    OUTPUT_VARIABLE HG_REVISION_TAG
alpar@927
    28
    ERROR_QUIET
alpar@927
    29
    OUTPUT_STRIP_TRAILING_WHITESPACE
alpar@927
    30
  )
alpar@927
    31
  EXECUTE_PROCESS(
alpar@982
    32
    COMMAND
alpar@982
    33
    hg log -r. --template "{latesttagdistance}"
ladanyi@678
    34
    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
alpar@982
    35
    OUTPUT_VARIABLE HG_REVISION_DIST
ladanyi@678
    36
    ERROR_QUIET
ladanyi@678
    37
    OUTPUT_STRIP_TRAILING_WHITESPACE
ladanyi@678
    38
  )
alpar@982
    39
  EXECUTE_PROCESS(
alpar@982
    40
    COMMAND
alpar@982
    41
    hg log -r. --template "{node|short}"
alpar@982
    42
    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
alpar@982
    43
    OUTPUT_VARIABLE HG_REVISION_ID
alpar@982
    44
    ERROR_QUIET
alpar@982
    45
    OUTPUT_STRIP_TRAILING_WHITESPACE
alpar@982
    46
  )
alpar@982
    47
alpar@982
    48
  IF(HG_REVISION_TAG STREQUAL "")
alpar@927
    49
    SET(HG_REVISION_ID "hg-tip")
alpar@927
    50
  ELSE()
alpar@982
    51
    IF(HG_REVISION_TAG STREQUAL "null")
alpar@982
    52
      SET(HG_REVISION_TAG "trunk")
alpar@982
    53
    ELSEIF(HG_REVISION_TAG MATCHES "^r")
alpar@982
    54
      STRING(SUBSTRING ${HG_REVISION_TAG} 1 -1 HG_REVISION_TAG)
alpar@982
    55
    ENDIF()
alpar@982
    56
    IF(HG_REVISION_DIST STREQUAL "0")
alpar@982
    57
      SET(HG_REVISION ${HG_REVISION_TAG})
alpar@927
    58
    ELSE()
alpar@982
    59
      SET(HG_REVISION
alpar@982
    60
	"${HG_REVISION_TAG}+${HG_REVISION_DIST}-${HG_REVISION_ID}")
alpar@927
    61
    ENDIF()
ladanyi@680
    62
  ENDIF()
alpar@982
    63
alpar@982
    64
  SET(LEMON_VERSION ${HG_REVISION} CACHE STRING "LEMON version string.")
ladanyi@678
    65
ENDIF()
ladanyi@678
    66
ladanyi@678
    67
SET(PROJECT_VERSION ${LEMON_VERSION})
alpar@225
    68
ladanyi@549
    69
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
alpar@225
    70
ladanyi@679
    71
FIND_PACKAGE(Doxygen)
ladanyi@679
    72
FIND_PACKAGE(Ghostscript)
alpar@1064
    73
alpar@1134
    74
IF(WIN32)
alpar@1134
    75
  SET(LEMON_WIN32 TRUE)
alpar@1134
    76
ENDIF(WIN32)
alpar@1134
    77
alpar@1064
    78
SET(LEMON_ENABLE_GLPK YES CACHE STRING "Enable GLPK solver backend.")
alpar@1064
    79
SET(LEMON_ENABLE_ILOG YES CACHE STRING "Enable ILOG (CPLEX) solver backend.")
alpar@1064
    80
SET(LEMON_ENABLE_COIN YES CACHE STRING "Enable COIN solver backend.")
alpar@1088
    81
SET(LEMON_ENABLE_SOPLEX YES CACHE STRING "Enable SoPlex solver backend.")
alpar@1064
    82
alpar@1064
    83
IF(LEMON_ENABLE_GLPK) 
alpar@1064
    84
  FIND_PACKAGE(GLPK 4.33)
alpar@1180
    85
  IF(GLPK_FOUND)
alpar@1180
    86
    SET(LEMON_HAVE_LP TRUE)
alpar@1180
    87
    SET(LEMON_HAVE_MIP TRUE)
alpar@1180
    88
    SET(LEMON_HAVE_GLPK TRUE)
alpar@1180
    89
  ENDIF(GLPK_FOUND)
alpar@1064
    90
ENDIF(LEMON_ENABLE_GLPK)
alpar@1064
    91
IF(LEMON_ENABLE_ILOG)
alpar@1064
    92
  FIND_PACKAGE(ILOG)
alpar@1180
    93
  IF(ILOG_FOUND)
alpar@1180
    94
    SET(LEMON_HAVE_LP TRUE)
alpar@1180
    95
    SET(LEMON_HAVE_MIP TRUE)
alpar@1180
    96
    SET(LEMON_HAVE_CPLEX TRUE)
alpar@1180
    97
  ENDIF(ILOG_FOUND)
alpar@1064
    98
ENDIF(LEMON_ENABLE_ILOG)
alpar@1064
    99
IF(LEMON_ENABLE_COIN)
alpar@1064
   100
  FIND_PACKAGE(COIN)
alpar@1180
   101
  IF(COIN_FOUND)
alpar@1180
   102
    SET(LEMON_HAVE_LP TRUE)
alpar@1180
   103
    SET(LEMON_HAVE_MIP TRUE)
alpar@1180
   104
    SET(LEMON_HAVE_CLP TRUE)
alpar@1180
   105
    SET(LEMON_HAVE_CBC TRUE)
alpar@1180
   106
  ENDIF(COIN_FOUND)
alpar@1064
   107
ENDIF(LEMON_ENABLE_COIN)
alpar@1088
   108
IF(LEMON_ENABLE_SOPLEX)
alpar@1088
   109
  FIND_PACKAGE(SOPLEX)
alpar@1180
   110
  IF(SOPLEX_FOUND)
alpar@1180
   111
    SET(LEMON_HAVE_LP TRUE)
alpar@1180
   112
    SET(LEMON_HAVE_SOPLEX TRUE)
alpar@1180
   113
  ENDIF(SOPLEX_FOUND)
alpar@1088
   114
ENDIF(LEMON_ENABLE_SOPLEX)
alpar@1064
   115
alpar@1064
   116
IF(ILOG_FOUND)
alpar@1064
   117
  SET(DEFAULT_LP "CPLEX")
alpar@1064
   118
  SET(DEFAULT_MIP "CPLEX")
alpar@1064
   119
ELSEIF(COIN_FOUND)
alpar@1064
   120
  SET(DEFAULT_LP "CLP")
alpar@1064
   121
  SET(DEFAULT_MIP "CBC")
alpar@1064
   122
ELSEIF(GLPK_FOUND)
alpar@1064
   123
  SET(DEFAULT_LP "GLPK")
alpar@1064
   124
  SET(DEFAULT_MIP "GLPK")
alpar@1088
   125
ELSEIF(SOPLEX_FOUND)
alpar@1088
   126
  SET(DEFAULT_LP "SOPLEX")
alpar@1064
   127
ENDIF()
alpar@1064
   128
alpar@1064
   129
IF(NOT LEMON_DEFAULT_LP OR
alpar@1064
   130
    (NOT ILOG_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CPLEX")) OR
alpar@1064
   131
    (NOT COIN_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CLP")) OR
alpar@1088
   132
    (NOT GLPK_FOUND AND (LEMON_DEFAULT_LP STREQUAL "GLPK")) OR
alpar@1088
   133
    (NOT SOPLEX_FOUND AND (LEMON_DEFAULT_LP STREQUAL "SOPLEX")))
alpar@1064
   134
  SET(LEMON_DEFAULT_LP ${DEFAULT_LP} CACHE STRING
alpar@1088
   135
    "Default LP solver backend (GLPK, CPLEX, CLP or SOPLEX)" FORCE)
alpar@1105
   136
ELSE()
alpar@1105
   137
  SET(LEMON_DEFAULT_LP ${DEFAULT_LP} CACHE STRING
alpar@1105
   138
    "Default LP solver backend (GLPK, CPLEX, CLP or SOPLEX)")
alpar@1064
   139
ENDIF()
alpar@1064
   140
IF(NOT LEMON_DEFAULT_MIP OR
alpar@1064
   141
    (NOT ILOG_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CPLEX")) OR
alpar@1064
   142
    (NOT COIN_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CBC")) OR
alpar@1064
   143
    (NOT GLPK_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "GLPK")))
alpar@1064
   144
  SET(LEMON_DEFAULT_MIP ${DEFAULT_MIP} CACHE STRING
alpar@1064
   145
    "Default MIP solver backend (GLPK, CPLEX or CBC)" FORCE)
alpar@1105
   146
ELSE()
alpar@1105
   147
  SET(LEMON_DEFAULT_MIP ${DEFAULT_MIP} CACHE STRING
alpar@1105
   148
    "Default MIP solver backend (GLPK, CPLEX or CBC)")
alpar@1064
   149
ENDIF()
alpar@1064
   150
ladanyi@473
   151
alpar@927
   152
IF(DEFINED ENV{LEMON_CXX_WARNING})
alpar@927
   153
  SET(CXX_WARNING $ENV{LEMON_CXX_WARNING})
alpar@927
   154
ELSE()
alpar@927
   155
  IF(CMAKE_COMPILER_IS_GNUCXX)
alpar@940
   156
    SET(CXX_WARNING "-Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas")
alpar@927
   157
    SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb")
alpar@927
   158
    SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb")
alpar@927
   159
  ELSEIF(MSVC)
alpar@927
   160
    # This part is unnecessary 'casue the same is set by the lemon/core.h.
alpar@1123
   161
    # Still kept as an example.
alpar@1123
   162
alpar@1123
   163
    # SET(CXX_WARNING "/wd4250 /wd4267 /wd4355 /wd4503 /wd4800 /wd4996")
alpar@1123
   164
alpar@927
   165
    # Suppressed warnings:
alpar@927
   166
    # C4250: 'class1' : inherits 'class2::member' via dominance
alpar@1123
   167
    # C4267: conversion from 'size_t' to 'type', possible loss of data
alpar@927
   168
    # C4355: 'this' : used in base member initializer list
alpar@927
   169
    # C4503: 'function' : decorated name length exceeded, name was truncated
alpar@927
   170
    # C4800: 'type' : forcing value to bool 'true' or 'false'
alpar@927
   171
    #        (performance warning)
alpar@927
   172
    # C4996: 'function': was declared deprecated
alpar@927
   173
  ELSE()
alpar@975
   174
    SET(CXX_WARNING "-Wall")
alpar@927
   175
  ENDIF()
alpar@927
   176
ENDIF()
alpar@927
   177
SET(LEMON_CXX_WARNING_FLAGS ${CXX_WARNING} CACHE STRING "LEMON warning flags.")
alpar@927
   178
alpar@927
   179
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LEMON_CXX_WARNING_FLAGS}")
alpar@927
   180
alpar@1017
   181
IF(MSVC)
alpar@1122
   182
  SET(CMAKE_CXX_FLAGS "/bigobj ${CMAKE_CXX_FLAGS}")
alpar@1017
   183
  SET( CMAKE_CXX_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
alpar@927
   184
    "Flags used by the C++ compiler during maintainer builds."
alpar@1017
   185
    )
alpar@1017
   186
  SET( CMAKE_C_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
alpar@927
   187
    "Flags used by the C compiler during maintainer builds."
alpar@1017
   188
    )
alpar@1017
   189
  SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
alpar@1017
   190
    "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
alpar@1017
   191
    "Flags used for linking binaries during maintainer builds."
alpar@1017
   192
    )
alpar@1017
   193
  SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
alpar@1017
   194
    "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
alpar@1017
   195
    "Flags used by the shared libraries linker during maintainer builds."
alpar@1017
   196
    )
alpar@1017
   197
ELSE()
alpar@1017
   198
  SET( CMAKE_CXX_FLAGS_MAINTAINER "-Werror -ggdb -O0" CACHE STRING
alpar@1017
   199
    "Flags used by the C++ compiler during maintainer builds."
alpar@1017
   200
    )
alpar@1017
   201
  SET( CMAKE_C_FLAGS_MAINTAINER "-Werror -O0" CACHE STRING
alpar@1017
   202
    "Flags used by the C compiler during maintainer builds."
alpar@1017
   203
    )
alpar@1017
   204
  SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
alpar@1111
   205
    "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
alpar@927
   206
    "Flags used for linking binaries during maintainer builds."
alpar@1017
   207
    )
alpar@1017
   208
  SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
alpar@1111
   209
    "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
alpar@927
   210
    "Flags used by the shared libraries linker during maintainer builds."
alpar@1017
   211
    )
alpar@1017
   212
ENDIF()
alpar@1017
   213
alpar@927
   214
MARK_AS_ADVANCED(
alpar@927
   215
    CMAKE_CXX_FLAGS_MAINTAINER
alpar@927
   216
    CMAKE_C_FLAGS_MAINTAINER
alpar@927
   217
    CMAKE_EXE_LINKER_FLAGS_MAINTAINER
alpar@927
   218
    CMAKE_SHARED_LINKER_FLAGS_MAINTAINER )
alpar@927
   219
alpar@927
   220
IF(CMAKE_CONFIGURATION_TYPES)
alpar@927
   221
  LIST(APPEND CMAKE_CONFIGURATION_TYPES Maintainer)
alpar@927
   222
  LIST(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES)
alpar@927
   223
  SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING
alpar@927
   224
      "Add the configurations that we need"
alpar@927
   225
      FORCE)
alpar@927
   226
 endif()
alpar@927
   227
alpar@927
   228
IF(NOT CMAKE_BUILD_TYPE)
alpar@927
   229
  SET(CMAKE_BUILD_TYPE "Release")
alpar@927
   230
ENDIF()
alpar@927
   231
alpar@927
   232
SET( CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
alpar@927
   233
    "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel Maintainer."
alpar@927
   234
    FORCE )
alpar@927
   235
alpar@927
   236
alpar@496
   237
INCLUDE(CheckTypeSize)
ladanyi@677
   238
CHECK_TYPE_SIZE("long long" LONG_LONG)
ladanyi@677
   239
SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG})
alpar@496
   240
deba@979
   241
INCLUDE(FindThreads)
alpar@980
   242
alpar@980
   243
IF(NOT LEMON_THREADING)
alpar@980
   244
  IF(CMAKE_USE_PTHREADS_INIT)
alpar@980
   245
    SET(LEMON_THREADING "Pthread")
alpar@980
   246
  ELSEIF(CMAKE_USE_WIN32_THREADS_INIT)
alpar@980
   247
    SET(LEMON_THREADING "Win32")
alpar@980
   248
  ELSE()
alpar@980
   249
    SET(LEMON_THREADING "None")
alpar@980
   250
  ENDIF()
alpar@980
   251
ENDIF()
alpar@980
   252
alpar@980
   253
SET( LEMON_THREADING "${LEMON_THREADING}" CACHE STRING
alpar@980
   254
  "Choose the threading library, options are: Pthread Win32 None."
alpar@980
   255
  FORCE )
alpar@980
   256
alpar@980
   257
IF(LEMON_THREADING STREQUAL "Pthread")
alpar@980
   258
  SET(LEMON_USE_PTHREAD TRUE)
alpar@980
   259
ELSEIF(LEMON_THREADING STREQUAL "Win32")
alpar@980
   260
  SET(LEMON_USE_WIN32_THREADS TRUE)
alpar@980
   261
ENDIF()
alpar@744
   262
alpar@225
   263
ENABLE_TESTING()
alpar@225
   264
alpar@927
   265
IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@927
   266
  ADD_CUSTOM_TARGET(check ALL COMMAND ${CMAKE_CTEST_COMMAND})
alpar@927
   267
ELSE()
alpar@927
   268
  ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND})
alpar@927
   269
ENDIF()
alpar@927
   270
alpar@225
   271
ADD_SUBDIRECTORY(lemon)
ladanyi@549
   272
IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
alpar@925
   273
  ADD_SUBDIRECTORY(contrib)
ladanyi@549
   274
  ADD_SUBDIRECTORY(demo)
ladanyi@549
   275
  ADD_SUBDIRECTORY(tools)
ladanyi@549
   276
  ADD_SUBDIRECTORY(doc)
ladanyi@549
   277
  ADD_SUBDIRECTORY(test)
ladanyi@679
   278
ENDIF()
alpar@225
   279
ladanyi@675
   280
CONFIGURE_FILE(
ladanyi@675
   281
  ${PROJECT_SOURCE_DIR}/cmake/LEMONConfig.cmake.in
ladanyi@675
   282
  ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
ladanyi@675
   283
  @ONLY
ladanyi@675
   284
)
ladanyi@675
   285
IF(UNIX)
ladanyi@675
   286
  INSTALL(
ladanyi@675
   287
    FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
ladanyi@675
   288
    DESTINATION share/lemon/cmake
ladanyi@675
   289
  )
ladanyi@675
   290
ELSEIF(WIN32)
ladanyi@675
   291
  INSTALL(
ladanyi@675
   292
    FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
ladanyi@675
   293
    DESTINATION cmake
ladanyi@675
   294
  )
ladanyi@679
   295
ENDIF()
ladanyi@675
   296
alpar@983
   297
CONFIGURE_FILE(
alpar@983
   298
  ${PROJECT_SOURCE_DIR}/cmake/version.cmake.in
alpar@983
   299
  ${PROJECT_BINARY_DIR}/cmake/version.cmake
alpar@983
   300
  @ONLY
alpar@983
   301
)
alpar@983
   302
alpar@983
   303
SET(ARCHIVE_BASE_NAME ${CMAKE_PROJECT_NAME})
alpar@983
   304
STRING(TOLOWER ${ARCHIVE_BASE_NAME} ARCHIVE_BASE_NAME)
alpar@983
   305
SET(ARCHIVE_NAME ${ARCHIVE_BASE_NAME}-${PROJECT_VERSION})
alpar@983
   306
ADD_CUSTOM_TARGET(dist
alpar@983
   307
  COMMAND cmake -E remove_directory ${ARCHIVE_NAME}
alpar@983
   308
  COMMAND hg archive ${ARCHIVE_NAME}
alpar@983
   309
  COMMAND cmake -E copy cmake/version.cmake ${ARCHIVE_NAME}/cmake/version.cmake
alpar@983
   310
  COMMAND tar -czf ${ARCHIVE_BASE_NAME}-nodoc-${PROJECT_VERSION}.tar.gz ${ARCHIVE_NAME}
alpar@983
   311
  COMMAND zip -r ${ARCHIVE_BASE_NAME}-nodoc-${PROJECT_VERSION}.zip ${ARCHIVE_NAME}
alpar@983
   312
  COMMAND cmake -E copy_directory doc/html ${ARCHIVE_NAME}/doc/html
alpar@983
   313
  COMMAND tar -czf ${ARCHIVE_NAME}.tar.gz ${ARCHIVE_NAME}
alpar@983
   314
  COMMAND zip -r ${ARCHIVE_NAME}.zip ${ARCHIVE_NAME}
alpar@983
   315
  COMMAND cmake -E copy_directory doc/html ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}
alpar@983
   316
  COMMAND tar -czf ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}.tar.gz ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}
alpar@983
   317
  COMMAND zip -r ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}.zip ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}
alpar@983
   318
  COMMAND cmake -E remove_directory ${ARCHIVE_NAME}
alpar@983
   319
  COMMAND cmake -E remove_directory ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}
alpar@983
   320
  DEPENDS html
alpar@983
   321
  WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
alpar@983
   322
alpar@983
   323
# CPACK config (Basically for NSIS)
alpar@927
   324
IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
ladanyi@679
   325
  SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
ladanyi@679
   326
  SET(CPACK_PACKAGE_VENDOR "EGRES")
ladanyi@679
   327
  SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
ladanyi@679
   328
    "LEMON - Library for Efficient Modeling and Optimization in Networks")
ladanyi@679
   329
  SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
alpar@225
   330
ladanyi@679
   331
  SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
alpar@225
   332
ladanyi@679
   333
  SET(CPACK_PACKAGE_INSTALL_DIRECTORY
ladanyi@679
   334
    "${PROJECT_NAME} ${PROJECT_VERSION}")
ladanyi@679
   335
  SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
ladanyi@679
   336
    "${PROJECT_NAME} ${PROJECT_VERSION}")
alpar@225
   337
ladanyi@679
   338
  SET(CPACK_COMPONENTS_ALL headers library html_documentation bin)
alpar@225
   339
ladanyi@679
   340
  SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers")
ladanyi@679
   341
  SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library")
ladanyi@679
   342
  SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities")
ladanyi@679
   343
  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation")
alpar@225
   344
ladanyi@679
   345
  SET(CPACK_COMPONENT_HEADERS_DESCRIPTION
ladanyi@679
   346
    "C++ header files")
ladanyi@679
   347
  SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION
ladanyi@679
   348
    "DLL and import library")
ladanyi@679
   349
  SET(CPACK_COMPONENT_BIN_DESCRIPTION
ladanyi@679
   350
    "Command line utilities")
ladanyi@679
   351
  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION
ladanyi@679
   352
    "Doxygen generated documentation")
alpar@225
   353
ladanyi@679
   354
  SET(CPACK_COMPONENT_HEADERS_DEPENDS library)
alpar@225
   355
ladanyi@679
   356
  SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
ladanyi@679
   357
  SET(CPACK_COMPONENT_LIBRARY_GROUP "Development")
ladanyi@679
   358
  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation")
alpar@225
   359
ladanyi@679
   360
  SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION
ladanyi@679
   361
    "Components needed to develop software using LEMON")
ladanyi@679
   362
  SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION
ladanyi@679
   363
    "Documentation of LEMON")
alpar@225
   364
ladanyi@679
   365
  SET(CPACK_ALL_INSTALL_TYPES Full Developer)
alpar@225
   366
ladanyi@679
   367
  SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
ladanyi@679
   368
  SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full)
ladanyi@679
   369
  SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full)
alpar@225
   370
ladanyi@679
   371
  SET(CPACK_GENERATOR "NSIS")
ladanyi@679
   372
  SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico")
ladanyi@679
   373
  SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico")
ladanyi@679
   374
  #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp")
ladanyi@679
   375
  SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico")
ladanyi@679
   376
  SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}")
ladanyi@679
   377
  SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu")
ladanyi@679
   378
  SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu")
ladanyi@679
   379
  SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu")
ladanyi@679
   380
  SET(CPACK_NSIS_CREATE_ICONS_EXTRA "
ladanyi@679
   381
    CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\"
ladanyi@679
   382
    ")
ladanyi@679
   383
  SET(CPACK_NSIS_DELETE_ICONS_EXTRA "
ladanyi@679
   384
    !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
ladanyi@679
   385
    Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\"
ladanyi@679
   386
    ")
alpar@225
   387
ladanyi@679
   388
  INCLUDE(CPack)
ladanyi@679
   389
ENDIF()