[CMake] try_compile question

Michael Jackson mike.jackson at bluequartz.net
Mon Jun 7 13:49:35 EDT 2010


   #############################################
   # Save required variable
   SET(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
   SET(CMAKE_REQUIRED_FLAGS_SAVE    ${CMAKE_REQUIRED_FLAGS})
   # Add HDF5_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES
   SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};$ 
{HDF5_INCLUDE_DIRS}")

   CHECK_SYMBOL_EXISTS(HDF5_BUILT_AS_DYNAMIC_LIB "H5config.h"  
HAVE_HDF5_DLL)
   if (HAVE_HDF5_DLL)
    SET (HDF5_IS_SHARED 1 CACHE INTERNAL "HDF5 Built as DLL or Shared  
Library")
   endif()

   # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables
   SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
   SET(CMAKE_REQUIRED_FLAGS    ${CMAKE_REQUIRED_FLAGS_SAVE})
   #
   #############################################

Should get you started....
___________________________________________________________
Mike Jackson                      www.bluequartz.net
Principal Software Engineer       mike.jackson at bluequartz.net
BlueQuartz Software               Dayton, Ohio


On Jun 7, 2010, at 1:35 PM, Mark Moll wrote:

>
> On Jun 7, 2010, at 12:19 PM, Torri, Stephen CIV NSWCDD, W15 wrote:
>
>>>
>>> From: cmake-bounces at cmake.org on behalf of Mark Moll
>>> Sent: Mon 6/7/2010 12:57 PM
>>> To: cmake at cmake.org
>>> Subject: [CMake] try_compile question
>>>
>>> /opt/local/bin/c++    -isysroot /Developer/SDKs/MacOSX10.5.sdk - 
>>> mmacosx-version-min=10.5   -o
>>> CMakeFiles/cmTryCompileExec.dir/CheckSZencoder.cpp.o -c /Users/ 
>>> mmoll/CMakeModules/CheckSZencoder.cpp
>>> /Users/mmoll/CMakeModules/CheckSZencoder.cpp:2:19: error: szlib.h:  
>>> No such file or directory
>>
>> It appears you do not have either the include directories set  
>> correctly or szlib.h is not installed.
>
>
> The output shows that szlib.h is correctly found here:
> /Users/mmoll/external/sandbox/include
>
> The "INCLUDE_DIRECTORIES ${SZ_INCLUDE}” part of the try_compile  
> command doesn’t seem to work or I don’t understand what it’s  
> supposed to do.
>
> -- 
> Mark
>
>
>
> _______________________________________________
> 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



More information about the CMake mailing list