[CMake] Problems with CHECK_TYPE_SIZE

William A. Hoffman billlist at nycap.rr.com
Wed Aug 9 14:41:34 EDT 2006


At 02:31 PM 8/9/2006, Tim Teulings wrote:
>Hello!
>
>I try to use the CHECK_TYPE_SIZE macro in the CheckTypeSize module to
>detect the availability and the size of wchar_t.
>
>Since wchar_t is not a build-in type but is defined in <string> I want
>the macro to include <string> before calculating the size.
>
>I tried the following sequence:
>
>INCLUDE(CheckTypeSize)
>SET(CMAKE_EXTRA_INCLUDE_FILES string)
>CHECK_TYPE_SIZE("wchar_t" SIZEOF_WCHAR_T)
>SET(CMAKE_EXTRA_INCLUDE_FILES)
>
>But this fails because it seems like the generated test file has the
>suffix ".c" and the compiler (gcc in my case) is called using gcc
>instead g++. Since gcc in this case compiles in "C"-mode instead in
>"C++"-mode like it would it it was call with the g++ frontend and thus
>does not have stl headers in the search path (and would not be able to
>parse them anyway) test fails with string not being found.
>
>How can I force cmake to use g++ in this case?

You need a CheckTypeSizeCXX.  Basically copy CheckTypeSize and create
a version that creates a .cxx file. 

-Bill



More information about the CMake mailing list