find_package(GTK)
How can I make it output something so that I can know whether it finds something or not?
Platform: windows XP
find_package(GTK)
How can I make it output something so that I can know whether it finds something or not?
Platform: windows XP
You can use the message command as in:
FIND_PACKAGE(GTK) IF (${GTK_FOUND}) MESSAGE(STATUS "Found GTK.") ELSE (${GTK_FOUND}) MESSAGE(STATUS "Could not locate GTK.") ENDIF (${GTK_FOUND})
Or, if you want it to abort if GTK isn't found:
FIND_PACKAGE(GTK) IF (${GTK_FOUND}) MESSAGE(STATUS "Found GTK.") ELSE (${GTK_FOUND}) MESSAGE(FATAL_ERROR "Could not locate GTK.") ENDIF (${GTK_FOUND})
Note that if you do the latter, then you can simply use the "REQUIRED" flag with FIND_PACKAGE, as specifying the "REQUIRED" flag ensures that it will fail with an error if it isn't found:
FIND_PACKAGE(GTK REQUIRED)
The command above will cause CMake to abort and print an error message if GTK is not found. You may also be interested in the documentation for FIND_PACKAGE from the CMake Manual. Also, one should note that FIND_PACKAGE(XYZ) actually invokes the CMake module FindXYZ, and so each package with a corresponding FIND_PACKAGE has its own CMake module implementing the find operation... since CMake is stilll somewhat new, some of those find modules are not correctly implemented... based on your comments below, it would seem that FindGTK has not been implemented correctly (since if it isn't present, the use of the REQUIRED flag should cause it to abort with a fatal error, but does not seem to do so in your case).