and then (after #5836) we have to wire up the so-created library a second time in AspectConfig.cmake:
# We create lib${_target}.debug.so, lib${_target}.release.so, or both
# depending on the compilation mode of ASPECT. Note that the user already
# created the target under the name ${_target}, so we only need to create
# a second target in the third case above.
# Note that you can not rename a target or change its filename, but you can
# modify the suffix. :-)
if(${ASPECT_BUILD_DEBUG} MATCHES "ON")
message(STATUS " setting up DEBUG variant")
deal_ii_setup_target(${_target} DEBUG)
set_target_properties(${_target} PROPERTIES SUFFIX ".debug.so")
list(APPEND _target_libs ${_target})
endif()
if(${ASPECT_BUILD_RELEASE} MATCHES "ON")
message(STATUS " setting up RELEASE variant")
add_library(${_target}.release SHARED $<TARGET_PROPERTY:${_target},SOURCES>) # ***************
deal_ii_setup_target(${_target}.release RELEASE)
set_target_properties(${_target}.release PROPERTIES SUFFIX ".so")
list(APPEND _target_libs ${_target}.release)
endif()
... much more...
The issue is with the marked line: We have to create a second library, having previously assumed that the first library created in user space is actually the debug one. That may not be true with CMAKE_BUILD_TYPE=Release when called in the user directory.
A much better approach would have been to create a macro ASPECT_SETUP_PLUGIN_LIBRARY(_target _source_files) that automatically decides what the library (or libraries) should be called, what its (their) properties should be, etc.
Working on #5836 shows that we create plugins in, let's say, an awkward way. In the user's
CMakeLists.txt
, we doand then (after #5836) we have to wire up the so-created library a second time in
AspectConfig.cmake
:The issue is with the marked line: We have to create a second library, having previously assumed that the first library created in user space is actually the debug one. That may not be true with
CMAKE_BUILD_TYPE=Release
when called in the user directory.A much better approach would have been to create a macro
ASPECT_SETUP_PLUGIN_LIBRARY(_target _source_files)
that automatically decides what the library (or libraries) should be called, what its (their) properties should be, etc.