Permalink
Browse files

Add Plugin: Fix linking of plugin test

Before this update linking the unit test of the Base64 plugin would
fail on Linux, reporting undefined references to `base64Decode` and
`base64Encode`, if only `BUILD_FULL` was enabled.
  • Loading branch information...
sanssecours committed Oct 26, 2018
1 parent 0b23f9e commit 1723cb4fe6119d9c92cd88232eb3970775872f5d
Showing with 11 additions and 21 deletions.
  1. +10 −11 cmake/Modules/LibAddPlugin.cmake
  2. +1 −10 src/plugins/base64/CMakeLists.txt
@@ -107,19 +107,18 @@ function (add_plugintest testname)
"${CMAKE_CURRENT_SOURCE_DIR}/testmod_${testname}.c")
endif (ARG_CPP)
if (BUILD_SHARED)
set (PLUGIN_TARGET_OBJS "")
if (ARG_LINK_PLUGIN)
if (NOT ARG_LINK_PLUGIN STREQUAL "<no>")
set (PLUGIN_TARGET_OBJS "$<TARGET_OBJECTS:elektra-${ARG_LINK_PLUGIN}-objects>")
endif ()
else ()
set (PLUGIN_TARGET_OBJS "$<TARGET_OBJECTS:elektra-${testname}-objects>") # assume that testcase+plugin to be
# tested have same name:
set (PLUGIN_TARGET_OBJS "")
if (ARG_LINK_PLUGIN)
if (NOT ARG_LINK_PLUGIN STREQUAL "<no>")
set (PLUGIN_TARGET_OBJS "$<TARGET_OBJECTS:elektra-${ARG_LINK_PLUGIN}-objects>")
endif ()
list (APPEND TEST_SOURCES
"${PLUGIN_TARGET_OBJS}")
else ()
set (PLUGIN_TARGET_OBJS "$<TARGET_OBJECTS:elektra-${testname}-objects>") # assume that testcase+plugin to be tested
# have same name:
endif ()
list (APPEND TEST_SOURCES
"${PLUGIN_TARGET_OBJS}")
set (testexename testmod_${testname})
add_executable (${testexename} ${TEST_SOURCES})
add_dependencies (${testexename} kdberrors_generated)
@@ -1,21 +1,12 @@
include (LibAddPlugin)
# We disable the test on Linux, if only `BUILD_FULL` is enabled. Otherwise the compiler reports errors about undefined references to
# `base64Encode` and `base64Decode`. See also: https://travis-ci.org/sanssecours/elektra/jobs/445799127.
set (DISABLE_TEST ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND ${BUILD_FULL} AND NOT ${BUILD_SHARED})
if (${DISABLE_TEST})
set (TEST_ARGUMENTS "")
else (${DISABLE_TEST})
set (TEST_ARGUMENTS ADD_TEST)
endif (${DISABLE_TEST})
add_plugin (base64
SOURCES base64_functions.h
base64_functions.c
base64.h
base64.c
COMPILE_DEFINITIONS ELEKTRA_PLUGIN_NAME=\"base64\"
ELEKTRA_PLUGIN_NAME_C=base64
ADD_TEST
TEST_README
${TEST_ARGUMENTS}
TEST_REQUIRED_PLUGINS ini)

0 comments on commit 1723cb4

Please sign in to comment.