Files
FairMQ/fairmq/plugins/PMIx/CMakeLists.txt
Christian Tacke cf12379afa cmake: Use target_compile_features()
Problem at hand: dependents (like FairRoot) need to know the
minimum C++ standard level that FairMQ (and its headers)
requires.

The first idea is to let the targets export their
CXX_STANDARD value. First, this doesn't seem to work as
expected.

Second, target_compile_features() seems to be the better
way to go. It has a much better granularity, automatically
has the export feature, and thus should make dependents
behave correctly.

Also drop all of this enforeced CMAKE_CXX_STANDARD*
setting. If it's given, check it. But that's it.

See: https://gitlab.kitware.com/cmake/cmake/-/issues/18446
See: https://cmake.org/cmake/help/latest/manual/cmake-compile-features.7.html#requiring-language-standards
2021-03-26 10:08:07 +01:00

35 lines
1.5 KiB
CMake

################################################################################
# Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# #
# This software is distributed under the terms of the #
# GNU Lesser General Public Licence (LGPL) version 3, #
# copied verbatim in the file "LICENSE" #
################################################################################
set(plugin FairMQPlugin_pmix)
add_library(${plugin} SHARED
${CMAKE_CURRENT_SOURCE_DIR}/PMIxPlugin.cxx
${CMAKE_CURRENT_SOURCE_DIR}/PMIxPlugin.h
${CMAKE_CURRENT_SOURCE_DIR}/PMIxCommands.h
${CMAKE_CURRENT_SOURCE_DIR}/PMIx.hpp
)
target_compile_features(${plugin} PUBLIC cxx_std_17)
target_link_libraries(${plugin} PUBLIC FairMQ PMIx::libpmix PRIVATE Commands)
target_include_directories(${plugin} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${plugin} PROPERTIES
CXX_VISIBILITY_PRESET hidden
VERSION ${PROJECT_VERSION}
SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
)
set(exe fairmq-pmix-command-ui)
add_executable(${exe} ${CMAKE_CURRENT_SOURCE_DIR}/runPMIxCommandUI.cxx)
target_link_libraries(${exe} FairMQ Commands StateMachine PMIx::libpmix)
target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
install(TARGETS ${plugin} ${exe}
EXPORT ${PROJECT_EXPORT_SET}
LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR}
RUNTIME DESTINATION ${PROJECT_INSTALL_BINDIR}
)