Skip to content

Commit b206268

Browse files
authored
Merge pull request #175 from leamas/master
Build: cmake polish, notably BUILD_TESTING option
2 parents 38fea5a + 4c56599 commit b206268

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
#
88
# See README.CMake
99

10+
set(PACKAGE shp)
11+
if (TARGET ${PACKAGE})
12+
return ()
13+
endif ()
14+
1015
# Version 3.11 or above of cmake is currently required for all platforms.
1116
cmake_minimum_required(VERSION 3.11)
1217
project(shapelib C CXX)
@@ -49,7 +54,6 @@ if(BUILD_SHARED_LIBS AND (WIN32 OR CYGWIN))
4954
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dll)
5055
endif()
5156

52-
set(PACKAGE shp)
5357

5458
# Set up install locations.
5559
set(
@@ -202,8 +206,9 @@ endif()
202206

203207
find_program(BASH_EXECUTABLE bash)
204208
if(BASH_EXECUTABLE)
205-
set(BUILD_TESTING ON CACHE BOOL "Build the testing tree.")
209+
option(BUILD_TESTING "Build tests" ON)
206210
else()
211+
set(BUILD_TESTING OFF CACHE BOOL "Disable tests")
207212
message(STATUS "WARNING: bash not available so disabling testing")
208213
endif()
209214

0 commit comments

Comments
 (0)