# HG changeset patch
# User Alpar Juttner <alpar@cs.elte.hu>
# Date 1637680078 -3600
# Tue Nov 23 16:07:58 2021 +0100
# Node ID ef70d6e9d8b63662d473d2a710c388ae1807f0d6
# Parent 779318694d8bc7836940300b83705f5267d41cb0
CMAKE Bugfixes and better build logic (#658)
diff --git a/CMakeLists.txt b/CMakeLists.txt
a
|
b
|
|
80 | 80 | option(LEMON_ENABLE_SOPLEX "Enable SoPlex solver backend." OFF) |
81 | 81 | |
82 | 82 | # Building + Testing |
83 | | option(LEMON_BUILD_TESTING "Enable unit tests" ON) |
84 | | option(LEMON_MAINTAINER "Enable Maintainer options." OFF) |
| 83 | option(LEMON_BUILD_TESTING "Enable unit tests" OFF) |
| 84 | option(LEMON_MAINTAINER_MODE "Enable Maintainer options." OFF) |
85 | 85 | option(LEMON_BUILD_DOCS "Enable docs using doxygen and ghostcript" OFF) |
86 | 86 | option(LEMON_BUILD_TOOLS "Enable project in tools directory" OFF) |
87 | 87 | option(LEMON_BUILD_DEMO "Enable project in demo directory" OFF) |
… |
… |
|
106 | 106 | # Add LEMON::LEMON target |
107 | 107 | include(base) |
108 | 108 | |
109 | | if(LEMON_MAINTAINER) |
| 109 | if(LEMON_MAINTAINER_MODE) |
110 | 110 | add_custom_target(check ALL COMMAND ${CMAKE_CTEST_COMMAND}) |
111 | 111 | else() |
112 | 112 | add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) |
113 | 113 | endif() |
114 | 114 | |
115 | | if(LEMON_BUILD_TESTING) |
116 | | add_subdirectory(test) |
117 | | endif() |
| 115 | add_subdirectory(test) |
118 | 116 | |
119 | 117 | if(LEMON_BUILD_TOOLS) |
120 | 118 | add_subdirectory(tools) |
diff --git a/cmake/version.cmake.in b/cmake/LEMONVersion.cmake.in
rename from cmake/version.cmake.in
rename to cmake/LEMONVersion.cmake.in
old
|
new
|
|
1 | | SET(LEMON_VERSION "@LEMON_VERSION@" CACHE STRING "LEMON version string.") |
| 1 | set(LEMON_VERSION "@LEMON_VERSION@" CACHE STRING "LEMON version string.") |
diff --git a/cmake/base.cmake b/cmake/base.cmake
a
|
b
|
|
143 | 143 | # GLPK # |
144 | 144 | if(LEMON_ENABLE_GLPK) |
145 | 145 | find_package(GLPK REQUIRED) |
| 146 | else() |
| 147 | find_package(GLPK) |
146 | 148 | endif() |
147 | | if(GLPK_FOUND) |
| 149 | if(LEMON_ENABLE_GLPK AND GLPK_FOUND) |
148 | 150 | set(LEMON_HAVE_LP ON) |
149 | 151 | set(LEMON_HAVE_MIP ON) |
150 | 152 | set(LEMON_HAVE_GLPK ON) |
… |
… |
|
153 | 155 | # ILOG # |
154 | 156 | if(LEMON_ENABLE_ILOG) |
155 | 157 | find_package(ILOG REQUIRED) |
| 158 | else() |
| 159 | find_package(ILOG) |
156 | 160 | endif() |
157 | | if(ILOG_FOUND) |
| 161 | if(LEMON_ENABLE_ILOG AND ILOG_FOUND) |
158 | 162 | set(LEMON_HAVE_LP ON) |
159 | 163 | set(LEMON_HAVE_MIP ON) |
160 | 164 | set(LEMON_HAVE_CPLEX ON) |
… |
… |
|
163 | 167 | # COIN # |
164 | 168 | if(LEMON_ENABLE_COIN) |
165 | 169 | find_package(COIN REQUIRED) |
| 170 | else() |
| 171 | find_package(COIN) |
166 | 172 | endif() |
167 | | if(COIN_FOUND) |
| 173 | if(LEMON_ENABLE_COIN AND COIN_FOUND) |
168 | 174 | set(LEMON_HAVE_LP ON) |
169 | 175 | set(LEMON_HAVE_MIP ON) |
170 | 176 | set(LEMON_HAVE_CLP ON) |
… |
… |
|
174 | 180 | # SOPLEX # |
175 | 181 | if(LEMON_ENABLE_SOPLEX) |
176 | 182 | find_package(SOPLEX REQUIRED) |
| 183 | else() |
| 184 | find_package(SOPLEX) |
177 | 185 | endif() |
178 | | if(SOPLEX_FOUND) |
| 186 | if(LEMON_ENABLE_SOPLEX AND SOPLEX_FOUND) |
179 | 187 | set(LEMON_HAVE_LP ON) |
180 | 188 | set(LEMON_HAVE_SOPLEX ON) |
181 | 189 | endif() |
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
a
|
b
|
|
59 | 59 | min_cost_arborescence_test |
60 | 60 | min_cost_flow_test |
61 | 61 | min_mean_cycle_test |
62 | | multicommodity_flow_test |
63 | 62 | nagamochi_ibaraki_test |
64 | 63 | path_test |
65 | 64 | planarity_test |
… |
… |
|
72 | 71 | vf2_test) |
73 | 72 | |
74 | 73 | if(LEMON_HAVE_LP) |
75 | | if(LEMON_MAINTAINER) |
| 74 | if(LEMON_MAINTAINER_MODE) |
76 | 75 | add_executable(lp_test lp_test.cc) |
77 | 76 | else() |
78 | 77 | add_executable(lp_test EXCLUDE_FROM_ALL lp_test.cc) |
… |
… |
|
95 | 94 | |
96 | 95 | target_link_libraries(lp_test ${LP_TEST_LIBS}) |
97 | 96 | add_test(lp_test lp_test) |
98 | | # add_dependencies(check lp_test) |
| 97 | add_dependencies(check lp_test) |
99 | 98 | |
100 | 99 | if(WIN32 AND LEMON_HAVE_GLPK) |
101 | 100 | get_target_property(TARGET_LOC lp_test LOCATION) |
… |
… |
|
120 | 119 | endif() |
121 | 120 | |
122 | 121 | if(LEMON_HAVE_MIP) |
123 | | if(LEMON_MAINTAINER) |
| 122 | if(LEMON_MAINTAINER_MODE) |
124 | 123 | add_executable(mip_test mip_test.cc) |
125 | 124 | else() |
126 | 125 | add_executable(mip_test EXCLUDE_FROM_ALL mip_test.cc) |
… |
… |
|
165 | 164 | endif() |
166 | 165 | |
167 | 166 | foreach(TEST_NAME ${TESTS}) |
168 | | add_executable(${TEST_NAME} ${TEST_NAME}.cc) |
| 167 | if(LEMON_MAINTAINER_MODE) |
| 168 | add_executable(${TEST_NAME} ${TEST_NAME}.cc) |
| 169 | else() |
| 170 | add_executable(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc) |
| 171 | endif() |
169 | 172 | target_link_libraries(${TEST_NAME} LEMON::LEMON) |
170 | 173 | target_include_directories( |
171 | 174 | ${TEST_NAME} |