[CMake] "INCLUDE called with wrong number of arguments" error, please help.

kdsfinger at gmail.com kdsfinger at gmail.com
Thu Jan 4 16:37:43 EST 2007


On 1/4/07, Bill Hoffman <bill.hoffman at kitware.com> wrote:
> kdsfinger at gmail.com wrote:
> > hi,
> > I recently installed the lapack library on my linux box and would like
> > to configure cmake to use it. I steal the FindLapack.cmake file from
> > http://www.mip.informatik.uni-kiel.de/~jw/cmake/CMakeModules/FindLAPACK.cmake
> >
> > (btw, I also use the FindGSL.cmake from there and it works great)
> > and put it in the cmake modules folder.
> > I have a CMakeList.txt like this:
> > ========================================
> > PROJECT(ta)
> >
> > FIND_PACKAGE(GSL)
> > INCLUDE(${GSL_INCLUDE_DIR})
> You want INCLUDE_DIRECTORIES and not INCLUDE.  INCLUDE is for including
> cmake code.
>
> -Bill
>
>

hi, Bill
I made some corrections and with manually set up the locations in
cmake, ccmake . is now doing fine. My CMakeLists.txt is
PROJECT(ta)

FIND_PACKAGE(GSL)
INCLUDE_DIRECTORIES(${GSL_INCLUDE_DIR})
ADD_DEFINITIONS(-g -Wall -O2 -fno-gcse -finline-functions -funswitch-loops )

FIND_PACKAGE(LAPACK)
IF(LAPACK_FOUND)
       INCLUDE_DIRECTORIES(${LAPACK_INCLUDE_DIR})
ELSE(LAPACK_FOUND)
       MESSAGE(FATAL_ERROR "Cannot build without LAPACK. Please set
LAPACK_DIR.")
ENDIF(LAPACK_FOUND)

#list all source files here
ADD_EXECUTABLE(
test testunsymm.c
 )

TARGET_LINK_LIBRARIES(test ${GSL_LIBRARIES} ${LAPACK_LIBRARIES} )

However, when I make the program, I got the following message seems
there is a link problem:
$ make
Scanning dependencies of target test
[100%] Building C object CMakeFiles/test.dir/testunsymm.o
Linking C executable test
/usr/bin/ld: cannot find -llapack
collect2: ld returned 1 exit status
make[2]: *** [test] Error 1
make[1]: *** [CMakeFiles/test.dir/all] Error 2
make: *** [all] Error 2

Why it can not find the lapack package? Is there something wrong with
CMakeLists.txt? Thanks for comments.

zl2k


More information about the CMake mailing list