I'm probably going to end up taking over the module since it seems to be
un-maintained but I'm hesitant to make radical changes to it.

The module has several issues but a major one is that it doesn't add the
required linker flags when using static libraries instead of shared.

It also doesn't check for any required C flags but that's a lesser issue.

These may only be a problem for the autotools based fltk build as the
module uses a ConfigFLTK for CMake based builds.

I have the following config to work around the issue which I'd like to
ultimately get into the module and out of my cmake config:

find_package(FLTK REQUIRED)
if(${FLTK_FOUND})
    include_directories(${FLTK_INCLUDE_DIRS})
    # Set required CXX flags.
    execute_process(COMMAND ${FLTK_CONFIG_SCRIPT} --cxxflags
        OUTPUT_VARIABLE FLTK_CXXFLAGS)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLTK_CXXFLAGS}")
    # FindFLTK does not properly handle ldflags for static libraries.
    get_filename_component(FLTK_LIB_EXT ${FLTK_BASE_LIBRARY} EXT)
    if(${FLTK_LIB_EXT} STREQUAL ${CMAKE_STATIC_LIBRARY_SUFFIX})

^^^ Is this the best way to determine if the library found was static or
shared? ^^^

        message(STATUS "Using static FLTK libraries.")
        execute_process(COMMAND ${FLTK_CONFIG_SCRIPT} --use-images
--ldstaticflags
            OUTPUT_VARIABLE FLTK_LDFLAGS)

^^^ The module doesn't check if the library is static, and even then it
only ^^^
^^^ runs --ldflags for the fltk images library.

        separate_arguments(FLTK_LDFLAGS)
        foreach(_FLAG ${FLTK_LDFLAGS})
            string(REGEX MATCH "^-l.+" _LDFLAG ${_FLAG})
            string(STRIP "${_LDFLAG}" _LDFLAG)
            list(APPEND FLTK_LIBRARIES ${_LDFLAG})
        endforeach()
        list(REMOVE_DUPLICATES FLTK_LIBRARIES)

^^^ This works, but is there a better way? ^^^

    endif()
    list(APPEND FLDIGI_LINK_LIBS ${FLTK_LIBRARIES})

So a broader question... Should we trust the output of a config program, in
this case, fltk-config? The writer of the module certainly doesn't. They
used the fltk-config program to find the base library, strip off the path
portion and then used it as a search path to find the libraries
independently.

I would like to update the module to use COMPONENTS, but the current
default is to find everything unless a "FLTK_SKIP_..." variable is set so I
assume there's a good way to keep backward compatibility.

Thanks,
Richard
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to