[CMake] Checking for Specific TR1 Headers
Andreas Pakulat
apaku at gmx.de
Wed Jan 23 13:58:15 EST 2013
Hi,
On Wed, Jan 23, 2013 at 5:17 PM, Michael Jackson
<mike.jackson at bluequartz.net> wrote:
> I am trying to determine if certain TR1 Headers are available to the compiler. My first test system is an OS X 10.6.8 system using the built in GCC. Here is the pertinent parts of my CMake file:
>
> macro (CORE_CHECK_INCLUDE_FILE header var prefix)
> CHECK_INCLUDE_FILE("${header}" ${prefix}_${var} )
> endmacro()
>
> #----- THIS FAILS with include file not found
> CORE_CHECK_INCLUDE_FILE("tr1/unordered_set" HAVE_TR1_UNORDERED_SET_H CMP)
>
> #----- THIS Succeeds.
> check_cxx_source_compiles(
> "#include <tr1/unordered_set>
> int main() {
> std::tr1::unordered_set<int> ptr;
> return 0;
> }
> "
> HAVE_TR1_UNORDERED_SET_H)
>
> I can go either way but I am wanting a deeper understanding of why the first test failed? This code is going to be used with Visual Studio and Linux so I am looking for more of a "bullet" proof way of finding these headers.
I guess the reason is that check_include_file uses the C compiler and
not the C++ compiler, hence the include is not found. Try
check_include_file_cxx instead.
Andreas
More information about the CMake
mailing list