On 30.12.2010 12:07, Julia Jacobson wrote:

> Building FLTK on Windows with Visual C++ worked fine for me.
> However, I can only build a FLTK GUI project using CMake if I use absolute 
> PATHs in my CMakeLists.txt file, which 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 )
>
> If I don't use absolute PATHs, CMake laments an unsuccessful search for the 
> FLTK files.
> The whole process works fine under linux, but I would like to have a portable 
> FLTK GUI project.
> I think this is probably no only a CMake issue, but rather to the way I 
> "installed" FLTK: Except for building it with Visual C++, I did nothing else 
> like for example adjusting the Windows PATH variable and so on.
> How can I install FLTK on Windows in a way that CMake can automatically find 
> it?

I really don't know how to do it, but maybe I have some hints that
could help.

The main point would be to find out how FINDPACKAGE(FLTK ...) works
on Windows. I have no idea and can't check it now. AFAIK this is
contributed by CMake, so you might find it somewhere.

Once you found out how it works, you could maybe "install" your
built FLTK libs, dlls, header files so that FINDPACKAGE can find
them...

Note that this (usage of FINDPACKAGE) has changed significantly in FLTK
1.3, but there is a README file how to use FLTK with CMake. But don't
expect too much, this may not help you either. As Ian said, we don't
have CMake experts in our developer team.

If you can't find a way to do it directly (with FIND_PACKAGE), you
could still make a more portable CMake file by using something like
this (just a little guessing, not tested):

if(WIN32)
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)
SET(FLTK_FOUND TRUE)
else
FIND_PACKAGE(FLTK REQUIRED)
endif(WIN32)
...

If nothing helps, you can also add a CMake option to configure the
Windows path you need and use it instead of the hard-coded strings
above.

HTH

Albrecht
_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to