[cmake-developers] CheckSymbolExists is unreliable

Rolf Eike Beer eike at sf-mail.de
Wed Jan 4 09:50:46 EST 2012


> On Tue, Jan 3, 2012 at 2:17 PM, Rolf Eike Beer <eike at sf-mail.de> wrote:

>> Pushed updated branch. Please review and merge to next if you like it.
>
> Can you handle Modules/CheckPrototypeDefinition.cmake too?  I think it
> has the same problem.

Will look at.

> There are a few problems with the current test.  The configured
> "cse.cmake" scripts end up driving the test builds using the CMake that
> was used to configure CMake's build tree, not the one that was just built
> and should be tested.

> Also they don't select the generator properly so will only work on Unix-
> like systems.

> I don't think you need to create a whole new build tree for every test.
> You can do all the test try-compiles right in the main test CMakeLists.txt
> file, just with different result cache variable names"
>
>   foreach(_config_type Release RelWithDebInfo MinSizeRel Debug)
>     set(CMAKE_TRY_COMPILE_CONFIGURATION ${_config_type})
>     check_symbol_exists(...)
>   endforeach()

> In order to test things like -O3, just add them temporarily to the
> CMAKE_C_FLAGS or CMAKE_CXX_FLAGS variables.

Nice. Will clean this up. When I put this directly into the CMakeLists.txt
the other problems should vanish, no?

> Finally, I'd like to tweak the first commit message slightly:
>
>  > CheckSymbolExists: try to force the compiler to keep the referenced
> symbol
>
> s/try to//
>
>  > previous version was not really using this. This lead to symbols that
> are
>
> s/lead to/leads to/

No problem.

Eike



More information about the cmake-developers mailing list