[Cmake] strange behavior
Stefan Schmidt
Stefan.Schmidt@sophia.inria.fr
Fri, 2 May 2003 17:45:19 +0200
Hello,
I have a strange problem with cmake (1.6.5) that I don't fully understand=
:
I've some CMake code like this (simplified here), that sets some cache en=
tries=20
in a loop:
---
SET (ALLPACKAGES
AuxPkgs/TestData
StdPkgs/ImagePkg
AuxPkgs/Package3
)
FOREACH(PKG ${ALLPACKAGES})
STRING(REGEX REPLACE "/" "_" PKGNAME ${PKG})
SET ("${PKGNAME}_DIR" ${CMAKE_BINARY_DIR}/${PKG} CACHE PATH "Locatio=
n of=20
package ${PKG}" FORCE)
ENDFOREACH(PKG)
SUBDIRS(TestSubDir)
---
Additionally to the intended AuxPkgs_TestData_DIR entries, a _DIR entry i=
s=20
created with the same value as the last correct one.
This isn't the case when there are no SUBDIRS! Appearently, it has someth=
ing=20
to do with the way CMake processes the subdirectories and rereads (?) the=
=20
parent's CMakeList.
I get around this if I use a (obviously superfluous) IF(PKGNAME)...ENDIF=20
around the cache setting.
I think this might either be a bug or the underlying mechanism how CMake=20
traverses the SUBDIRs has to be better documented.=20
Kind regards,
Stefan