<div dir="auto">I will need the VTKExamples to support both api's. Also a few remote modules.</div><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 29, 2018, 11:18 AM Ben Boeckel <<a href="mailto:ben.boeckel@kitware.com">ben.boeckel@kitware.com</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Oct 29, 2018 at 10:57:10 -0700, Bill Lorensen wrote:<br>
> Will I be able to support both old and new?<br>
<br>
As a consumer of modules is much easier than as a module. The variable<br>
names which control things are completely different (now "namespaced"<br>
via naming conventions). `find_package(VTK)` is similar as long as<br>
`VTK_LIBRARIES` was used and components are specified, but the old<br>
module's CMake API is gone.<br>
<br>
Old "is X enabled" detection (though this shouldn't be necessary in<br>
general[1]):<br>
<br>
```cmake<br>
if (Module_X)<br>
```<br>
<br>
New:<br>
<br>
```cmake<br>
if (TARGET X)<br>
```<br>
<br>
But, the module names are also different now in the new VTK as well, so<br>
that makes consuming harder (though predictable).<br>
<br>
Building a library used to be:<br>
<br>
```cmake<br>
vtk_module_library(X ${srcs})<br>
```<br>
<br>
and now has a much richer API:<br>
<br>
```cmake<br>
vtk_module_add_module(X<br>
SOURCES ${srcs}<br>
HEADERS ${headers}<br>
PRIVATE_HEADERS ${private_headers})<br>
```<br>
<br>
though there is also `CLASSES` which does the de-facto standard<br>
`.cxx`/`.h` pairing for `SOURCES` and `HEADERS` automatically. In<br>
addition to the ineffectiveness of `target_*` functions on module names<br>
due to the kits implementation, making a module which supports both APIs<br>
is not going to be trivial.<br>
<br>
--Ben<br>
<br>
[1]Optional dependencies now pass `-DVTK_MODULE_ENABLE_X=` as 1 or 0 if<br>
available where `X` is a "safe" name for the module (basically `::`<br>
replaced by `_`). This is to promote `#if` rather than `#ifdef` usage<br>
for optional dependency detection in C++ code which triggers errors if<br>
present in public headers (though in consuming targets) and also<br>
triggers warnings if the optional dependency is removed or made<br>
non-optional (because the define is no longer present).<br>
</blockquote></div>