From 4f4c248f342d9342c58eef706f1edd7321f2c1c6 Mon Sep 17 00:00:00 2001 From: wschenck Date: Sat, 1 Dec 2018 18:08:10 +0100 Subject: [PATCH] Fix handling of sionlib defines within CMake system --- CMakeLists.txt | 8 +++++++- cmake/FindSIONlib.cmake | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ffce85651d..6d6bf380c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -273,6 +273,11 @@ if ( with-defines ) set( ALL_CXXFLAGS "${def} ${ALL_CXXFLAGS}" ) endforeach () endif () +# add sionlib defines +foreach ( def ${SIONLIB_DEFINES} ) + set( ALL_CFLAGS "${ALL_CFLAGS} ${def}" ) + set( ALL_CXXFLAGS "${ALL_CXXFLAGS} ${def}" ) +endforeach () # all libraries set( ALL_LIBS @@ -289,7 +294,8 @@ set( ALL_LIBS "${LIBNEUROSIM_LIBRARIES}" "${MUSIC_LIBRARIES}" "${MPI_CXX_LIBRARIES}" - "${SIONLIB_LIBS}" ) + "${SIONLIB_LIBRARIES}" ) + if ( with-libraries ) set( ALL_LIBS "${ALL_LIBS};${with-libraries}" ) endif () diff --git a/cmake/FindSIONlib.cmake b/cmake/FindSIONlib.cmake index 2698d61516..80972ed753 100644 --- a/cmake/FindSIONlib.cmake +++ b/cmake/FindSIONlib.cmake @@ -88,6 +88,8 @@ if ( NOT SIONLIB_CONFIG STREQUAL "SIONLIB_CONFIG-NOTFOUND" ) if ( "${def}" MATCHES "^-D.*" ) # add to defines set( SIONLIB_DEFINES ${SIONLIB_DEFINES} "${def}" CACHE INTERNAL "cmake sucks" ) + # add current definition at CMake level + add_definitions( "${def}" ) endif () endforeach () endif ()