diff options
author | Uilian Ries <uilianries@gmail.com> | 2024-02-14 19:24:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-14 10:24:17 -0800 |
commit | 398e16e7cc20545a19f2af2293cc6f04310e6b7a (patch) | |
tree | 63bd7a870406f1459f67767b0e681aa193739739 | |
parent | ab30060a6ed10aca62d8efe9f96c2b7ec05e70f6 (diff) |
[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 <uilianries@gmail.com>
-rw-r--r-- | CMakeLists.txt | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fcf29b..d613f81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0) -OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON) -OPTION(ENABLE_SSL "Build hiredis_ssl for SSL support" OFF) -OPTION(DISABLE_TESTS "If tests should be compiled or not" OFF) -OPTION(ENABLE_SSL_TESTS "Should we test SSL connections" OFF) -OPTION(ENABLE_EXAMPLES "Enable building hiredis examples" OFF) -OPTION(ENABLE_ASYNC_TESTS "Should we run all asynchronous API tests" OFF) -# Historically, the NuGet file was always install; default -# to ON for those who rely on that historical behaviour. -OPTION(ENABLE_NUGET "Install NuGET packaging details" ON) - MACRO(getVersionBit name) SET(VERSION_REGEX "^#define ${name} (.+)$") FILE(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/hiredis.h" @@ -27,6 +17,16 @@ MESSAGE("Detected version: ${VERSION}") PROJECT(hiredis LANGUAGES "C" VERSION "${VERSION}") INCLUDE(GNUInstallDirs) +OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON) +OPTION(ENABLE_SSL "Build hiredis_ssl for SSL support" OFF) +OPTION(DISABLE_TESTS "If tests should be compiled or not" OFF) +OPTION(ENABLE_SSL_TESTS "Should we test SSL connections" OFF) +OPTION(ENABLE_EXAMPLES "Enable building hiredis examples" OFF) +OPTION(ENABLE_ASYNC_TESTS "Should we run all asynchronous API tests" OFF) +# Historically, the NuGet file was always install; default +# to ON for those who rely on that historical behaviour. +OPTION(ENABLE_NUGET "Install NuGET packaging details" ON) + # Hiredis requires C99 SET(CMAKE_C_STANDARD 99) SET(CMAKE_DEBUG_POSTFIX d) |