Skip to content

Commit 398e16e

Browse files
authored
[cmake] Fix cmake options position to support cmake toolchain (#1250)
Move CMake `OPTION` values below where we declare the `PROJECT` so they are scoped within it. Signed-off-by: Uilian Ries <[email protected]>
1 parent ab30060 commit 398e16e

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

CMakeLists.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0)
22

3-
OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON)
4-
OPTION(ENABLE_SSL "Build hiredis_ssl for SSL support" OFF)
5-
OPTION(DISABLE_TESTS "If tests should be compiled or not" OFF)
6-
OPTION(ENABLE_SSL_TESTS "Should we test SSL connections" OFF)
7-
OPTION(ENABLE_EXAMPLES "Enable building hiredis examples" OFF)
8-
OPTION(ENABLE_ASYNC_TESTS "Should we run all asynchronous API tests" OFF)
9-
# Historically, the NuGet file was always install; default
10-
# to ON for those who rely on that historical behaviour.
11-
OPTION(ENABLE_NUGET "Install NuGET packaging details" ON)
12-
133
MACRO(getVersionBit name)
144
SET(VERSION_REGEX "^#define ${name} (.+)$")
155
FILE(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/hiredis.h"
@@ -27,6 +17,16 @@ MESSAGE("Detected version: ${VERSION}")
2717
PROJECT(hiredis LANGUAGES "C" VERSION "${VERSION}")
2818
INCLUDE(GNUInstallDirs)
2919

20+
OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON)
21+
OPTION(ENABLE_SSL "Build hiredis_ssl for SSL support" OFF)
22+
OPTION(DISABLE_TESTS "If tests should be compiled or not" OFF)
23+
OPTION(ENABLE_SSL_TESTS "Should we test SSL connections" OFF)
24+
OPTION(ENABLE_EXAMPLES "Enable building hiredis examples" OFF)
25+
OPTION(ENABLE_ASYNC_TESTS "Should we run all asynchronous API tests" OFF)
26+
# Historically, the NuGet file was always install; default
27+
# to ON for those who rely on that historical behaviour.
28+
OPTION(ENABLE_NUGET "Install NuGET packaging details" ON)
29+
3030
# Hiredis requires C99
3131
SET(CMAKE_C_STANDARD 99)
3232
SET(CMAKE_DEBUG_POSTFIX d)

0 commit comments

Comments
 (0)