[CMake] linking error with gsl

Philip Lowman philip at yhbt.com
Mon Sep 14 07:26:03 EDT 2009


Have you tried using "make VERBOSE=1" to get the full command line being
executed?

It looks like `/usr/local/bin/gsl-config might be being passed to the linker
via target_link_libraries()?
CMake doesn't evaluate backticks, you'll have to use a command like
execute_process().

There might be a problem in the FindGSL module you're using.  This might
take some debugging with the message() command to trace down.  There are
several find modules shipped with CMake 2.6.4 that use a "foo-config" style
program to parse include directories and libraries which may be helpful.
One is FindFLTK.cmake for example.

On Sun, Sep 13, 2009 at 4:05 PM, Benoist Laurent <laurentbenoist at hotmail.com
> wrote:

>  Hi,
>
> I'm a begginner with CMake.
> I've got a project with all sources written and I want to switch to a CMake
> building process.
> My project is quite small :
>   - 5 sources in myProject/src directory
>   - 5 headers in myProject/include directory
>
> The problem is that is need to link with the gsl libraries.
> I used the FindGSL.cmake file that I found here
> http://www.cmake.org/pipermail/cmake/2006-March/008628.html.
>
> But when I type make, this error occurs :
> Linking C executable myExe
> i686-apple-darwin9-gcc-4.0.1: `/usr/local/bin/gsl-config: No such file or
> directory
> make[2]: *** [myExe] Error 1
> make[1]: *** [CMakeFiles/myExe.dir/all] Error 2
> make: *** [all] Error 2
>
> It's quite strange because the program /usr/local/bin/gsl-config does exist
> and prints -L/usr/local/lib -lgsl -lgslcblas -lm.
> This is my CMakeLists.txt file :
>
> CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
> PROJECT(PROJET)
>
> FIND_PACKAGE(GSL REQUIRED)
>
> SET(PROJET_SRCS
>     ./src/FN_functions.c
>     ./src/HH_functions.c
>     ./src/HR_functions.c
>     ./src/Iz_functions.c
>     ./src/main.c
>     ./src/misc.c
>     ./src/ML_functions.c
>     ./src/parsing.c
>     ./src/stim.c
> )
>
> SET(INCLUDE_DIRS
>     ${PROJET_SOURCE_DIR}/include
>     ${GSL_INCLUDE_DIRS}
> )
>
> SET(LIBS ${LIBS} ${GSL_LIBRARIES})
>
> INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
> ADD_DEFINITIONS(-Wall -ansi -pedantic -02)
> ADD_EXECUTABLE(myExe ${PROJET_SRCS})
>
> TARGET_LINK_LIBRARIES(myExe ${LIBS})
>
> --------------
>
> Do you see the problem ?
>
>
> ------------------------------
> Achetez un nouveau PC et bénéficiez de Windows 7 dès sa sortie ! En savoir
> plus <http://www.portable-windows.com/>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090914/5ce5f570/attachment.htm>


More information about the CMake mailing list