1 | 1 |
CMAKE_MINIMUM_REQUIRED(VERSION 2.6) |
2 | 2 |
|
3 | 3 |
SET(PROJECT_NAME "LEMON") |
4 | 4 |
PROJECT(${PROJECT_NAME}) |
5 | 5 |
|
6 |
INCLUDE(FindPythonInterp) |
|
7 |
|
|
6 | 8 |
IF(EXISTS ${PROJECT_SOURCE_DIR}/cmake/version.cmake) |
7 | 9 |
INCLUDE(${PROJECT_SOURCE_DIR}/cmake/version.cmake) |
8 | 10 |
ELSEIF(DEFINED ENV{LEMON_VERSION}) |
9 | 11 |
SET(LEMON_VERSION $ENV{LEMON_VERSION} CACHE STRING "LEMON version string.") |
10 | 12 |
ELSE() |
11 | 13 |
EXECUTE_PROCESS( |
12 |
COMMAND ./scripts/chg-len.py |
|
14 |
COMMAND ${PYTHON_EXECUTABLE} ./scripts/chg-len.py |
|
13 | 15 |
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} |
14 | 16 |
OUTPUT_VARIABLE HG_REVISION_PATH |
15 | 17 |
ERROR_QUIET |
16 | 18 |
OUTPUT_STRIP_TRAILING_WHITESPACE |
17 | 19 |
) |
18 | 20 |
EXECUTE_PROCESS( |
19 | 21 |
COMMAND hg id -i |
20 | 22 |
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} |
21 | 23 |
OUTPUT_VARIABLE HG_REVISION |
22 | 24 |
ERROR_QUIET |
23 | 25 |
OUTPUT_STRIP_TRAILING_WHITESPACE |
24 | 26 |
) |
25 | 27 |
IF(HG_REVISION STREQUAL "") |
26 | 28 |
SET(HG_REVISION_ID "hg-tip") |
27 | 29 |
ELSE() |
28 |
|
|
30 |
IF(HG_REVISION_PATH STREQUAL "") |
|
31 |
SET(HG_REVISION_ID ${HG_REVISION}) |
|
32 |
ELSE() |
|
33 |
SET(HG_REVISION_ID ${HG_REVISION_PATH}.${HG_REVISION}) |
|
34 |
ENDIF() |
|
29 | 35 |
ENDIF() |
30 | 36 |
SET(LEMON_VERSION ${HG_REVISION_ID} CACHE STRING "LEMON version string.") |
31 | 37 |
ENDIF() |
32 | 38 |
|
33 | 39 |
SET(PROJECT_VERSION ${LEMON_VERSION}) |
34 | 40 |
|
35 | 41 |
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) |
36 | 42 |
|
37 | 43 |
FIND_PACKAGE(Doxygen) |
38 | 44 |
FIND_PACKAGE(Ghostscript) |
39 | 45 |
FIND_PACKAGE(GLPK 4.33) |
40 | 46 |
FIND_PACKAGE(CPLEX) |
41 | 47 |
FIND_PACKAGE(COIN) |
42 | 48 |
|
43 | 49 |
INCLUDE(CheckTypeSize) |
44 | 50 |
CHECK_TYPE_SIZE("long long" LONG_LONG) |
45 | 51 |
SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG}) |
46 | 52 |
|
47 |
INCLUDE(FindPythonInterp) |
|
48 |
|
|
49 | 53 |
ENABLE_TESTING() |
50 | 54 |
|
51 | 55 |
ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND}) |
52 | 56 |
|
53 | 57 |
ADD_SUBDIRECTORY(lemon) |
54 | 58 |
IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) |
55 | 59 |
ADD_SUBDIRECTORY(demo) |
56 | 60 |
ADD_SUBDIRECTORY(tools) |
57 | 61 |
ADD_SUBDIRECTORY(doc) |
58 | 62 |
ADD_SUBDIRECTORY(test) |
59 | 63 |
ENDIF() |
60 | 64 |
|
61 | 65 |
CONFIGURE_FILE( |
62 | 66 |
${PROJECT_SOURCE_DIR}/cmake/LEMONConfig.cmake.in |
63 | 67 |
${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake |
64 | 68 |
@ONLY |
65 | 69 |
) |
66 | 70 |
IF(UNIX) |
67 | 71 |
INSTALL( |
68 | 72 |
FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake |
69 | 73 |
DESTINATION share/lemon/cmake |
70 | 74 |
) |
71 | 75 |
ELSEIF(WIN32) |
72 | 76 |
INSTALL( |
0 comments (0 inline)