[CMake] FFTW_FOUND is true even if it is not found?

Michael Wild themiwi at gmail.com
Tue Aug 23 00:54:51 EDT 2011


On Mon 22 Aug 2011 10:20:56 PM CEST, David Doria wrote:
>> From just that module, I do not have a reasonable explanation...
>>
>> What does this code output, when placed:
>> (1) directly after the find_package(FFTW) call?
>> (2) at the very bottom of your CMakeLists.txt file...?
>>
>>  message(STATUS "FFTW_INCLUDE_DIR='${FFTW_INCLUDE_DIR}'")
>>  message(STATUS "FFTW_LIBRARIES='${FFTW_LIBRARIES}'")
>>  message(STATUS "FFTW_FOUND='${FFTW_FOUND}'")
>>  message(STATUS "CMAKE_MODULE_PATH='${CMAKE_MODULE_PATH}'")
> 
> Bah, I was not using CMake syntax for the conditional:
> 
> if(NOT ${FFTW_FOUND})
> 
> vs
> 
> if(!${FFTW_FOUND})
>   MESSAGE(FATAL_ERROR "FFTW3 was not found!")
> endif()
> 
> (shouldn't that throw an "invalid syntax" error? What is "!" in CMake?)
> 
>> Is "find_package(FFTW)" exactly how you call it?
> 
> My call is:
> find_package(FFTW REQUIRED)
> 
> Shouldn't this produce the same error I am manually trying to produce
> above (since it is marked as required but not found)?
> 
> Thanks,
> 
> David

You'll need to handle the REQUIRED argument yourself. Read the 
Modules/readme.txt [1] file for more info. But probably, it would be a 
better idea to use FindPackageHandleStandardArgs module anyways.

Michael

[1] http://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/readme.txt



More information about the CMake mailing list