[CMake] linking error with gsl

Benoist Laurent laurentbenoist at hotmail.com
Sun Sep 13 16:05:29 EDT 2009


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 ?


_________________________________________________________________
Tchattez en direct en en vidéo avec vos amis !  
http://www.windowslive.fr/messenger/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090913/dfba4853/attachment.htm>


More information about the CMake mailing list