[CMake] ADD_SUBDIRECTORY error

Filipe Sousa filipe at ipb.pt
Fri Jul 28 06:48:56 EDT 2006


Xavier Larrode wrote:
> Hi all,
> 
> I'm compiling a subDirectory ie : ( ${GVTROOTDIR}/src/test )  with this 
> CMakeList.txt :
> # get GVTROOT ENV VAR
> SET(GVTROOTDIR $ENV{GVTROOT})
> # keep all *.cpp files
> FILE(GLOB CPPFILES  RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
> MESSAGE("Fichiers à compiler ${CPPFILES}")
> #EXE
> SET(TARGET ${GVTROOTDIR}/lib/libTrace.so)
> ADD_EXECUTABLE(${TARGET} ${CPPFILES})
> #CFLAGS
> SET(DEBUG_FLAGS "-g -Wall")
> INCLUDE_DIRECTORIES(
>   ${GVTROOTDIR}/src/include )
> #LD
> SET(LINK_FLAGS "-elf -shared")
> #ADD CFLAGS TO TARGET
> SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS "${DEBUG_FLAGS}")
> #ADD LDFLAGS TO TARGET
> SET_TARGET_PROPERTIES(${TARGET} PROPERTIES LINK_FLAGS "${LINK_FLAGS}")
> 
> 
> And i got a problem with the INCLUDE_DIRECTORIES and this error message :
> ADD_SUBDIRECTORY A full source directory was specified that is not in 
> the source tree but no binary directory was specified. If you specify an 
> out of tree source directory then you must provide the binary directory 
> as well.
> 
> Any idea how to do it ?
> 
> And actually, i'm trying to compile a library, so i had "-elf -shared"  
> to the LINK_FLAGS but i don't know if it's the right solution...
> 
> Thanks .

FILE(GLOB CPPFILES  RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
IF(CMAKE_COMPILER_IS_GNUCXX)
  SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
ADD_LIBRARY(Trace ${CPPFILES})

-- 
Filipe Sousa

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://public.kitware.com/pipermail/cmake/attachments/20060728/4e1a759c/signature.pgp


More information about the CMake mailing list