commit a3b81d574ac20a1f17eea245da6096f59416b8f7 Author: Wolfgang Frisch Date: Thu Feb 15 10:23:03 2024 +0100 cmake: fix semicolons in CFLAGS of custom modules Both `openssl.cmake` and `pcscd.cmake` use FindPkgConfig to retrieve the required CFLAGS and LDFLAGS. However FindPkgConfig returns lists [1], which are stored as semicolon-separated strings in CMake. This breaks the build when there's more than one flag in any of those variables. Fixes https://github.com/Yubico/yubico-piv-tool/issues/474 Index: yubico-piv-tool-2.5.2/CMakeLists.txt =================================================================== --- yubico-piv-tool-2.5.2.orig/CMakeLists.txt +++ yubico-piv-tool-2.5.2/CMakeLists.txt @@ -25,7 +25,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.12) # policy CMP0025 is to get AppleClang identifier rather than Clang for both # this matters since the apple compiler accepts different flags. cmake_policy(SET CMP0025 NEW) Index: yubico-piv-tool-2.5.2/cmake/openssl.cmake =================================================================== --- yubico-piv-tool-2.5.2.orig/cmake/openssl.cmake +++ yubico-piv-tool-2.5.2/cmake/openssl.cmake @@ -84,8 +84,9 @@ macro (find_libcrypto) endif(WIN32 OR OPENSSL_STATIC_LINK) message(" OpenSSL version: ${OPENSSL_VERSION}") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCRYPTO_CFLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCRYPTO_CFLAGS}") + list(JOIN LIBCRYPTO_CFLAGS " " LIBCRYPTO_CFLAGS_STRING) + set(CMAKE_C_FLAGS "${LIBCRYPTO_CFLAGS_STRING} ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "${LIBCRYPTO_CFLAGS_STRING} ${CMAKE_CXX_FLAGS}") link_directories(${LIBCRYPTO_LIBRARY_DIRS}) include_directories(${LIBCRYPTO_INCLUDE_DIRS}) Index: yubico-piv-tool-2.5.2/cmake/pcscd.cmake =================================================================== --- yubico-piv-tool-2.5.2.orig/cmake/pcscd.cmake +++ yubico-piv-tool-2.5.2/cmake/pcscd.cmake @@ -75,7 +75,7 @@ macro (find_pcscd) set(ENV{PKG_CONFIG_PATH} "${PCSCLITE_PKG_PATH}:$ENV{PKG_CONFIG_PATH}") pkg_check_modules(PCSC REQUIRED libpcsclite) if(PCSC_FOUND) - set(PCSC_LIBRARIES ${PCSC_LDFLAGS}) + list(JOIN PCSC_LDFLAGS " " PCSC_LIBRARIES) if(VERBOSE_CMAKE) message("PCSC_FOUND: ${PCSC_FOUND}") message("PCSC_LIBRARY_DIRS: ${PCSC_LIBRARY_DIRS}") @@ -124,4 +124,5 @@ macro (find_pcscd) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PCSC_CFLAGS}") link_directories(${PCSC_LIBRARY_DIRS}) -endmacro() \ No newline at end of file +endmacro() +