Skip to content

Commit

Permalink
cmake: do influence CMAKE_DEBUG_POSTFIX of the outer project (if any)
Browse files Browse the repository at this point in the history
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: libevent#1371
  • Loading branch information
azat committed Nov 20, 2022
1 parent ed079c9 commit 650d861
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Expand Down

0 comments on commit 650d861

Please sign in to comment.