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