]> granicus.if.org Git - libevent/commitdiff
cmake: do influence CMAKE_DEBUG_POSTFIX of the outer project (if any)
authorAzat Khuzhin <azat@libevent.org>
Sun, 20 Nov 2022 13:51:36 +0000 (14:51 +0100)
committerAzat Khuzhin <azat@libevent.org>
Sun, 20 Nov 2022 13:54:08 +0000 (14:54 +0100)
Consider the following example:

    $ touch lib.c
    $ cat > CMakeLists.txt <<EOL
    add_subdirectory(/src/le/libevent libevent EXCLUDE_FROM_ALL)
    add_library(lib lib.c)
    EOL
    $ mkdir .cmake
    $ cmake -DCMAKE_BUILD_TYPE=debug -G Ninja ..
    $ ninja
    $ ls *.a
    liblibd.a

So now outer project also has "d" prefix for libraries.

Let's avoid this by setting non-cached variable.

Fixes: #1371
CMakeLists.txt

index 8a86b1948a1dfd8ef30bf21698db0043d1b25dec..65cfedaba3bd1e06ed4e230f7b5ab98d8feb2672 100644 (file)
@@ -37,7 +37,7 @@ if(NOT CMAKE_BUILD_TYPE)
 endif()
 string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
 
-set(CMAKE_DEBUG_POSTFIX d CACHE STRING "Debug library postfix" FORCE)
+set(CMAKE_DEBUG_POSTFIX d)
 
 set(EVENT__LIBRARY_TYPE DEFAULT CACHE STRING
     "Set library type to SHARED/STATIC/BOTH (default SHARED for MSVC, otherwise BOTH)")