[CMake] FLTKConfig.cmake on Microsoft Windows

Michael Hertling mhertling at online.de
Thu Dec 30 10:43:59 EST 2010


On 12/30/2010 11:01 AM, Julia Jacobson wrote:
> With your help, everything seems to work now.
> My final subdirectory src/CMakeLists.txt looks like this:
> 
> SET(FLTK_DIR "C:/Program Files/fltk-1.1.9/")
> SET(FLTK_BASE_LIBRARY "C:/Program Files/fltk-1.1.9/lib/")
> SET(FLTK_FORMS_LIBRARY "C:/Program Files/fltk-1.1.9/lib/")
> SET(FLTK_GL_LIBRARY "C:/Program Files/fltk-1.1.9/lib/")
> SET(FLTK_IMAGES_LIBRARY "C:/Program Files/fltk-1.1.9/lib/")
> SET(FLTK_INCLUDE_DIR "C:/Program Files/fltk-1.1.9/include/")
> SET(FLTK_SKIP_FLUID TRUE)
> FIND_PACKAGE(FLTK REQUIRED)
> if( FLTK_FOUND )
> include_directories( ${FLTK_INCLUDE_DIR} )
> add_executable( hello main.cpp )
> target_link_libraries( hello ${FLTK_LIBRARIES} )
> else( FLTK_FOUND )
> message(FATAL_ERROR "Could not find FLTK")
> endif( FLTK_FOUND )
> 
> What grieves me is that the CMake code I had prepared in linux looked 
> really nice (without any absolute paths and so on), but the file for 
> Windows doesn't.
> Truth be told, what's the point of using CMake here instead of a 
> Makefile? Simply rewriting the build script doesn't cause that more work 
> either.
> Would it help to add the FLTK directory to the Windows PATH variable?

FYI: On *nix, I have installed FLTK 1.1.10 in /tmp/fltk for testing
purposes, and CMake gracefully finds it when CMAKE_PREFIX_PATH is set
accordingly, i.e. cmake -DCMAKE_PREFIX_PATH=/tmp/fltk ... IMO, that's
the preferred way to direct FIND_PACKAGE() to an exceptional location.
So, have you already tried this instead of setting FLTK_INCLUDE_DIR,
FLTK_DIR or the like?

Regards,

Michael

>> Am Mittwoch, den 29.12.2010, 20:03 +0100 schrieb Julia Jacobson:
>>> Thanks for your answer. The file FindFLTK.cmake exists within my CMake
>>> installation, but I still get an error message:
>>> "CMake Error at C:/Program Files/CMake
>>> 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91
>>> (MESSAGE):
>>> Could NOT find FLTK (missing: FLTK_LIBRARIES FLTK_FLUID_EXECUTABLE)"
>>> This is probably due to the fact that I haven't indicated anywhere where
>>> to find my FLTK installation (i.e. C:\Program Files\fltk-1.1.10).
>>>
>> Actually the module file (here FindFLTK) should find the libraries on
>> any platforms, but in this case...
>>
>> Before FIND_PACKAGE(FLTK REQUIRED) insert:
>>
>> SET(FLTK_DIR "C:/Program Files/fltk-1.1.10") # NO backslash!
>>
>> If you did not install "fluid")
>> SET(FLTK_SKIP_FLUID TRUE)
>>
>> FIND_PACKAGE(...
>>
>> Micha


More information about the CMake mailing list