From d92de5951a748cfe04cf95839d68917e08ff1a6b Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 6 Feb 2025 01:36:36 +0100 Subject: [PATCH] cmake: initialize variables where missing As detected using `cmake --warn-uninitialized`. It also lists documented CMake global variables, which is unexpected: `CMAKE_MODULE_PATH`, `CMAKE_IMPORT_LIBRARY_SUFFIX`. I'd expect CMake to initialize its namespace. https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-warn-uninitialized Closes #1539 --- src/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fe595d3c..109e50cf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -84,6 +84,13 @@ set(_sources ${CSOURCES} ${HHEADERS}) ## Library definition +if(NOT DEFINED IMPORT_LIB_SUFFIX) + set(IMPORT_LIB_SUFFIX "") +endif() +if(NOT DEFINED STATIC_LIB_SUFFIX) + set(STATIC_LIB_SUFFIX "") +endif() + # Ensure that the static library and import library filenames are different, # when building both static and shared library. On Windows, with certain # toolchains (e.g. MSVC) these libraries get the same by default, overwriting