Building CLI Extension copies to wrong output directories (cmake issue)

I hope I might find some help here. I recently started working on the PkModeling extension an I am trying to get it to build on various continuous integration platforms (Appveyor for Win and Travis CI for Linux and Mac).

I got the build working on Appveyor but it copies some of the generated files to the wrong output. So the expected output would be “[pkmodeling-build]/bin/Release” (expected files there are: PkModeling.exe, PkModelingLib.dll, PkModelingTest.exe, PkSolver.lib, PkModeling.xml). This works fine when I also build all the dependencies (ITK, DCMTK, ZLIB). However, to avoid building these dependencies on the CI platform I download them pre-built and then tell cmake to use those instead of building them again:

cmake -G "Visual Studio 12 2013 Win64" -DITK_DIR:PATH=C:\ITK-install\lib\cmake\ITK-4.10 -DSlicerExecutionModel_DIR:PATH=C:\SlicerExecutionModel\SlicerExecutionModel-build -DDCMTK_DIR:PATH=C:\DCMTK-install\cmake -DZLIB_ROOT:PATH=c:\zlib-install -DZLIB_INCLUDE_DIR:PATH=c:\zlib-install\include -DZLIB_LIBRARY:FILEPATH=c:\zlib-install\lib\zlib.lib c:\pkmodeling

And now suddenly the files “PkModeling.exe” and “PkModelingLib.dll” are going to “[pkmodeling-build]/CLI/bin/Release” and the XML is going nowhere :confused: The output directories are defined around line 120 in the main CMakeLists.txt. But I think the SEMMacroBuildCLI from Slicer Execution Model is also setting output dirs. However I can’t seem to figure out why the little difference in calling cmake causes this behavior.

I fixed this with a hack in the appveyor.yml by copying the files via cmd, so that the test can run. But this does not seem like the right way :wink:

Nice work adding support for CI :+1:

You will find below some more details to help you make progress

the XML is going nowhere

That is strange, here is the code taking care of this:

Details about handling of *_OUTPUT_DIRECTORY and INSTALL_*_DESTINATION

When building against SlicerExecutionModel, by default the output_dirs and install_dirs are the one used to configure/build SlicerExecutionModel specifying variables like:

  • SlicerExecutionModel_DEFAULT_CLI_${type}_OUTPUT_DIRECTORY
  • SlicerExecutionModel_DEFAULT_CLI_INSTALL_${type}_DESTINATION

with ${type} being any of RUNTIME, LIBRARY or ARCHIVE,

If for some reason, the default install and output dirs used to configure SlicerExecutionModel are not satisfactory. These can be globally overridden in the project by setting these variables before calling the macro:

  • SlicerExecutionModel_CLI_${type}_OUTPUT_DIRECTORY
  • SlicerExecutionModel_CLI_INSTALL_${type}_DESTINATION

Last, these can also be overridden on a per CLI basis by passing parameters to the macro:


The logic can be found here for output dir:

and here for install destination:

Thanks, explicitly passing the output dirs to the macro helped with the libs and exes already. Now I’ll see about the xml.

OK, found the problem with the XML copying: I was cloning a branch, which didn’t contain the code to copy the XML yet. :roll_eyes: