[CMake] RES: Problem with the path when including another Cmakelist file

Renan Greinert Renan.Greinert at daiken.com.br
Wed Feb 3 14:16:47 EST 2010


Hi Ryan,
Thank you for the reply.
I've just tried that. It solved the error, but the variables  REUSE_CODE_HEADERS  and  REUSE_CODE_SRCS   are empty when I try to use them in my project's CMakelists.

Here is a simpler code I've written to show the problem:

#The CMakelists.txt from my reusable codes folder

#cmake_minimum_required(VERSION 2.6.4)
set ( DAIKEN_TYPE_HEADERS
                DaikenType.h
)

And now the CMakelists from my project:

cmake_minimum_required(VERSION 2.6.4)

add_subdirectory( ../../Basico "${CMAKE_CURRENT_BINARY_DIR}/binBD" )

PROJECT (Test)

ADD_EXECUTABLE( Test main.cpp ${DAIKEN_TYPE_HEADERS})

No errors are happening, but it is not adding the ${DAIKEN_TYPE_HEADERS} to my project.

What is wrong?

Thanks!

P.s.: By the way, does anyone have any information on when the Mastering CMake book will be disponible for buying?
I've sent an e-mail to kitware, but I've received no answer :(




De: Ryan Pavlik [mailto:rpavlik at iastate.edu]
Enviada em: quarta-feira, 3 de fevereiro de 2010 15:20
Para: Renan Greinert
Assunto: Re: [CMake] Problem with the path when including another Cmakelist file

You just want a file named CMakeLists.txt in each directory, and then use add_subdirectory(directory-name) to recurse into that subdirectory - no need to use include.


On 2/3/10 7:35 AM, Renan Greinert wrote:
Hello,
I am trying to develop a database for codes for reuse, and I would like to use CMake to manage it.
Here is how my files are organizated:

In
/codes/Thread/
IThread.h
Thread.cpp
Runnable.h
CMakelists_Thread.txt



Then, inside CMakelists_Thread.txt I have:

#cmake_minimum_required(VERSION 2.6.4)

set (THREADS_HEADERS
                IThread.h
                Runnable.h )

set (THREADS_SRCS
      Thread.cpp )
endif (WIN32)


set ( REUSE_CODE_HEADERS
                ${ REUSE_CODE_HEADERS }
                ${ THREADS_HEADERS }
)

set (REUSE_CODE_SRCS
                ${ REUSE_CODE_SRCS }
                ${ THREADS_SRCS }
)



Then I have a project that uses Threads.  This project is in /project/src

So, in /project/src I have my CMakelists.txt:


cmake_minimum_required(VERSION 2.6.4)

include ( "../../codes/Thread/CMakelists_Thead.txt" )

PROJECT (Test)

INCLUDE_DIRECTORIES (${REUSE_CODE_HEADERS } )

ADD_EXECUTABLE( Test main.cpp ${ REUSE_CODE_HEADERS } ${ REUSE_CODE_SRCS } )



When I try to run CMake on it, it returns the error that "IThread.h" was not found.

If I move the project files to the /codes/Thread/ folder (and update the path of the "include" in CMakelists.txt) it works fine.
So it seems that CMake is considering the path of CMakelists.txt to include the IThread.h, Runnable.h and Thread.cpp, and not the path of CMakelists_thread.txt.

Is there any way to solve this problem?

Thanks!

Renan














________________________________
AVISO LEGAL
Esta mensagem é exclusivamente para a pessoa a quem se destina e pode conter informações confidenciais ou legalmente protegidas. A transmissão incorreta da mensagem não acarreta a perda de seu caráter confidencial. Caso ela tenha sido recebida por engano, solicitamos que seja devolvida ao remetente e apagada de seu sistema imediatamente. É vedado, a qualquer pessoa que não seja destinatário, usar, revelar, distribuir ou copiar qualquer parte desta mensagem.

DISCLAIMER
This message is destined exclusively to the intendend receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is receiveid by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not intendend receiver to use, reveal, distribute, or copy any part if this message.






_______________________________________________

Powered by www.kitware.com<http://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




--

Ryan Pavlik

Human-Computer Interaction Graduate Student

Virtual Reality Applications Center

Iowa State University



rpavlik at iastate.edu<mailto:rpavlik at iastate.edu>

http://academic.cleardefinition.com/

________________________________
AVISO LEGAL
Esta mensagem é exclusivamente para a pessoa a quem se destina e pode conter informações confidenciais ou legalmente protegidas. A transmissão incorreta da mensagem não acarreta a perda de seu caráter confidencial. Caso ela tenha sido recebida por engano, solicitamos que seja devolvida ao remetente e apagada de seu sistema imediatamente. É vedado, a qualquer pessoa que não seja destinatário, usar, revelar, distribuir ou copiar qualquer parte desta mensagem.

DISCLAIMER
This message is destined exclusively to the intendend receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is receiveid by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not intendend receiver to use, reveal, distribute, or copy any part if this message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100203/6c222843/attachment-0001.htm>


More information about the CMake mailing list