[CMake] Checking for Specific TR1 Headers

Michael Jackson mike.jackson at bluequartz.net
Wed Jan 23 11:17:27 EST 2013


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
mike.jackson at bluequartz.net              www.bluequartz.net



More information about the CMake mailing list