[CMake] Problem with TRY_RUN

Eduardo Alberto Hernández Muñoz coz.eduardo.hernandez at gmail.com
Sat May 24 16:47:48 EDT 2008


Hi

>> I'm trying to add a version check to the FindOpenAL.cmake module.
>> Here's the relevant part:
>>
>>    TRY_RUN (
>>        OPENAL_VERSION_1_1
>>        OPENAL_COMPILED
>>        ${CMAKE_BINARY_DIR}
>>        ${CMAKE_SOURCE_DIR}/check_openal_version_1_1.cpp
>>        )
>>
>> A simple 'g++ check_openal_version_1_1.cpp' compiles well in a
>> terminal, but OPENAL_COMPILED is set to FALSE. Upon checking the
>> makefile generated with 'cmake --debug-trycompile', I see this error:
>>
>> [...]
>> Scanning dependencies of target cmTryCompileExec
>> make[2]: Leaving directory
>> `/home/coz/Proyectos/STK_Ex/supertuxkart/build/obj/CMakeFiles/CMakeTmp'
>> make -f CMakeFiles/cmTryCompileExec.dir/build.make
>> CMakeFiles/cmTryCompileExec.dir/build
>> make[2]: Entering directory
>> `/home/coz/Proyectos/STK_Ex/supertuxkart/build/obj/CMakeFiles/CMakeTmp'
>> make[2]: *** No rule to make target
>>
>> `/home/coz/Proyectos/STK_Ex/supertuxkart/build/check_openal_version_1_1.cpp',
>> needed by
>> `CMakeFiles/cmTryCompileExec.dir/check_openal_version_1_1.cpp.o'.
>>  Stop.
>> make[2]: Leaving directory
>> `/home/coz/Proyectos/STK_Ex/supertuxkart/build/obj/CMakeFiles/CMakeTmp'
>> make[1]: *** [CMakeFiles/cmTryCompileExec.dir/all] Error 2
>> make[1]: Leaving directory
>> `/home/coz/Proyectos/STK_Ex/supertuxkart/build/obj/CMakeFiles/CMakeTmp'
>> make: *** [all] Error 2
>> [...]
>>
>> In case you wonder, /home/coz/Proyectos/STK_Ex/supertuxkart/build/ is
>> the correct directory; running CMake 2.6.0 .
>>

> Does this file exist:
>
> /home/coz/Proyectos/STK_Ex/supertuxkart/build/check_openal_version_1_1.cpp

Yes it does. In fact, if instead of

    TRY_RUN (
        OPENAL_VERSION_1_1
        OPENAL_COMPILED
        ${CMAKE_BINARY_DIR}
        ${CMAKE_SOURCE_DIR}/check_openal_version_1_1.cpp
        )

I write

    TRY_RUN (
        OPENAL_VERSION_1_1
        OPENAL_COMPILED
        ${CMAKE_BINARY_DIR}
        check_openal_version_1_1.cpp
        )

CMake complains about not finding the file before creating the makefile.

-Coz


More information about the CMake mailing list