[cmake-developers] GenerateExportHeader macro in CMake?
Brad King
brad.king at kitware.com
Fri Jul 29 18:25:20 EDT 2011
On 07/13/2011 08:41 AM, Stephen Kelly wrote:
> I've been working on my GenerateExportHeader macro described here:
>
> http://thread.gmane.org/gmane.comp.programming.tools.cmake.user/36664
Nice idea.
> The result is here:
>
> https://gitorious.org/~steveire/cmake/steveires-
> cmake/commit/a80318ae6a299f44de8597d4ee705278554b7a4a
>
> The problem is that the unit tests don't pass because the try_compile is
> done before building the libraries under test. By commenting out the
> try_compile you can build the libraries, uncomment and the tests compile
> again.
>
> This seems to be intended behaviour of try_compile.
Yes, it is the intended behavior to do a cmake-time check well before the
main build occurs.
> Is there some workaround?
There are a few approaches to try:
(1) Use try_compile to build the libraries too. The signature that accepts
both a source and build tree will do a cmake-time build and leave the trees
around.
(2) Look at how the LinkFlags test works in order to verify a failed build.
This might be better but I'm not sure off the top of my head if it applies
to the test you're trying to define.
> I've so far only tried it on linux. It is still work in progress, but I will
> test it on Windows too soon.
Great. We would like it to work everywhere it makes sense before including.
> How do I get this into CMake? I understand that if it's in I have to
> maintain it in the cmake git. Do I need to send a public ssh key somewhere?
http://www.cmake.org/Wiki/CMake:Module_Maintainers
-Brad
More information about the cmake-developers
mailing list