Slicer / SlicerExecutionModel

An open-source CMake-based project that provides macros and associated tools for the easy building of 3D Slicer command line interface (CLI) modules.
https://www.slicer.org/wiki/Documentation/Nightly/Developers/SlicerExecutionModel
Other
33 stars 50 forks source link

Add support for CMake function target_compile_features #83

Open fbudin69500 opened 8 years ago

fbudin69500 commented 8 years ago

When compiling a target that has specific C++ requirements, one can use the new CMake function target_compile_features() [1].

There is currently no way of passing these requirements to SEMMacroBuildCLI, and the targets created in the macro are not exposed to the user. It would be great to either be able:

  1. to pass the requirements to the CMake macro or
  2. to expose the list of targets created by the macro.

Note: Both solutions are not mutually exclusive and even if 1) is implemented, 2) might still be useful in certain corner cases.

[1] https://cmake.org/cmake/help/v3.6/command/target_compile_features.html

jcfr commented 8 years ago

Thanks for creating the report.

My first idea would be to extend the SEMMacroBuildCLI API to accept an optional multi value parameters named COMPILE_FEATURES.

They could be listed doing something like this:

SEMMacroBuildCLI(
  NAME ${MODULE_NAME}
  LOGO_HEADER ${Slicer_SOURCE_DIR}/Resources/ITKLogo.h
  TARGET_LIBRARIES ${ITK_LIBRARIES}
  COMPILE_FEATURES
    PRIVATE cxx_digit_separators cxx_generic_lambdas
    PUBLIC cxx_alias_templates
  )

If there are features we could generally expect to be available for all CLI, a variable named SlicerExecutionModel_REQUIRED_COMPILE_FEATURES could also be hardcoded in the SlicerExecutionModel project ...