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

Maik Beckmann maikbeckmann at gmx.de
Thu Jan 4 17:16:37 EST 2007


Am Donnerstag, den 04.01.2007, 16:37 -0500 schrieb kdsfinger at gmail.com:

> 
> 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
>  )
> 

Do it like this:

<CMakeLists.txt>
PROJECT(ta)

FIND_PACKAGE(GSL)
FIND_PACKAGE(LAPACK REQUIRED)

## This is a no go! Use ccmake, press t and alter CMAKE_CXX_FLAGS
# ADD_DEFINITIONS(-g -Wall -O2 -fno-gcse -finline-functions
-funswitch-loops ) 

include_directories(
    ${GSL_INCLUDE_DIR} 
    # This should be renamed to LAPCK_INCLUDE_DIRS ...
    ${LAPCK_INCLUDE_DIRECTORIES} )
link_directories(
    ${GSL_LINK_DIRECTORIES}
    # now ld will find -llapack ...
    ${LAPACK_LINK_DIRECTORIES} ) 

#list all source files here
ADD_EXECUTABLE(test 
   testunsymm.c )
target_link_libraries(test 
    ${GSL_LIBRARIES} 
    ${LAPACK_LIBRARIES} )
</CMakeLists.txt>

HTH, Maik Beckmann



More information about the CMake mailing list