Flex, Bison, and CMake compatibility
Nicolas Alvarez
nicolas.alvarez at gmail.com
Fri Jun 24 22:10:04 CEST 2011
Hi,
I'm trying to change the kdelibs buildsystem to generate Flex and Bison
parsers at compile time, instead of keeping the generated code in version
control.
One problem I'm hitting is compatibility with CMake 2.6. The FindFLEX and
FindBISON modules were introduced in CMake 2.8. Copying the files into
kdelibs/cmake/modules still fails because they use ${CMAKE_CURRENT_LIST_DIR}
to include FindPackageStandardArgs, and that variable was also introduced in
CMake 2.8. (note that I don't plan to make kdelibs install these two
modules; they're just for kdelibs's own use).
The reason it uses CMAKE_CURRENT_LIST_DIR is to workaround an
incompatibility hell with FindPackageStandardArgs (interesting read):
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c4275592a8
As far as I can tell, we don't have this problem, because the version of
FindPackageStandardArgs included in kdelibs/cmake/modules is new enough and
has the "second mode" that FindFLEX and FindBISON use. So a simple
INCLUDE(FindPackageHandleStandardArgs) would work, or we could prefix it
with ${kdelibs_SOURCE_DIR}/cmake/modules/ to be 100% sure.
A second problem is that kdelibs already has a FindFlex.cmake (note case!)
which is pretty different, it only looks for the flex executable and sets a
variable with its path, but it doesn't have its own fancy targets to run it.
We would have problems in Windows if cmake/modules contains two modules with
the same name. And yet we can't just delete FindFlex.cmake, because it's
*installed*, so we'd break kdelibs source compatibility!
How to solve this second problem?
--
Nicolas
More information about the Kde-buildsystem
mailing list