Checking for Specific TR1 Headers

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Checking for Specific TR1 Headers

Michael Jackson
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.

Thanks
___________________________________________________________
Mike Jackson                    Principal Software Engineer
BlueQuartz Software                            Dayton, Ohio
[hidden email]              www.bluequartz.net

--

Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Checking for Specific TR1 Headers

Andreas Pakulat-2
Hi,

On Wed, Jan 23, 2013 at 5:17 PM, Michael Jackson
<[hidden email]> 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
--

Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake