colcon / colcon-cmake

Extension for colcon to support CMake packages
http://colcon.readthedocs.io
Apache License 2.0
16 stars 25 forks source link

avoid duplicating explicitly passed ctest-args -C/--build-type #64

Closed KazNX closed 4 years ago

KazNX commented 4 years ago

Colcon does not respect using --ctest-args --build-type <config> (where --build-type is equivalent to -C). Instead it reads the CMakeCache and extracts the last value for CMAKE_BUILD_TYPE. This does not work well with multi-configuration generators as you can only test the last build run.

Colcon's test functionality should prefer an explicityl --build-type specification on the command line over the current behaviour.

dirk-thomas commented 4 years ago

Thanks for the report.

It should be fairly easy to update the function which currently extracts the build type from the CMake cache to check the passed CTest args before if a build type was passed explicitly.

Would you like to contribute a pull request to support this use case?

dirk-thomas commented 4 years ago

@KazNX Friendly ping.

KazNX commented 4 years ago

See https://github.com/colcon/colcon-cmake/pull/65

KazNX commented 4 years ago

Correction: I've just worked out that the current behaviour is sort of correct. The existing behaviour will generate command lines like the following:

ctest -C Debug -C Release

Note the presence of multiple -C (or the --build-config alias) arguments. When I reported the issue, I had incorrectly configured my mixin to pass -C=Release, which CTest interprets as a distinct and unknown argument.

While this reduces lowers the significance of this bug report and the PR above, the fix should stand as the duplication of ctest arguments is technically incorrect. The PR removes the -C duplication.

dirk-thomas commented 4 years ago

Resolved by #65.