[CMake] 1 tricky question, 1 bug report
Marcel Loose
loose at astron.nl
Fri Mar 13 11:55:49 EDT 2009
Hi Denis,
If only project SOMENAME in directory targetA depends on LibXml2, then
you should move the line INCLUDE(FindLibXml2) to the file
targetA/CMakeLists.txt.
BTW, I'd prefer to use find_package(LibXml2), but that may be a matter
of taste.
Best regards,
Marcel Loose.
On Fri, 2009-03-13 at 07:52 -0700, Denis Scherbakov wrote:
> > I don't understand the question here? At gmake time
> > why do they need to know anything about mico or libxml2?
>
> Ok, I will try harder now:
>
> Let's say I have a main CMakeLists.txt and 2 sub projects:
> =============CMakeLists.txt
> CMAKE_MINIMUM_REQUIRED(VERSION 2.6.1 FATAL_ERROR)
>
> INCLUDE(FindLibXml2)
>
> ADD_SUBDIRECTORY(targetA)
> ADD_SUBDIRECTORY(targetB)
> =============targetA/CMakeLists.txt
> PROJECT(SOMENAME)
>
> SET (SOMENAME_SRCS "source.cpp")
>
> IF ( NOT LIBXML2_FOUND )
> MESSAGE( FATAL_ERROR "Required library libxml2 was not found." )
> ENDIF ()
>
> ADD_EXECUTABLE(somename ${SOMENAME_SRCS})
> =============targetB/CMakeLists.txt
> PROJECT(OTHERNAME)
>
> SET (OTHERNAME_SRCS "other_source.cpp")
>
> ADD_EXECUTABLE(othername ${OTHERNAME_SRCS})
> =============
>
> Now, I have a developer which wants to build "othername" from targetB
> directory, which does not depend on anything. He does:
>
> cmake /path/to/main/file/
>
> Before the developer issues "gmake othername" he gets an error that
> LibXml2 was not found.
>
> How to perform a dependency check, only when the project is being built?
> Or how to get a cmake code, which gets executed before the project starts
> to build, like in ADD_CUSTOM_COMMAND?
>
> > Try CMake 2.6.3, I am pretty sure we fixed the fortran
> > comment module issue.
>
> I have "cmake version 2.6-patch 3" from http://www.cmake.org/files/v2.6/cmake-2.6.3.tar.gz. The bug is still there.
>
> Denis
>
>
>
> _______________________________________________
> Powered by 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
More information about the CMake
mailing list