[CMake] Using gnu flux with cmake

Martin Koller martin.koller at etm.at
Tue Dec 18 13:53:40 EST 2012


On Monday 17 December 2012 19:45:53 Derek Cole wrote:
> 
> I am trying to figure out what I am doing wrong when trying to use just flex in a Cmake file to build a shared lib.
> 
> i basically have the following
> 
> find_package(FLEX)
> FLEX_TARGET(Test ../src/test.l ../src/test.c)
> set(SRC_FILES mysource.c ${FLEX_Test_OUTPUTS})
> add_libary(testlib ${SRC_FILES})
> target_link_libraries(testlib crypto c ${FLEX_LIBRARIES})
> 
> this is giving me a problem saying it cant find ../src/test.c

I assume there is a problem with WHERE the generated file is located.
In the docs they say:
FLEX_TARGET(MyScanner lexer.l  ${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp)

so try to use ${CMAKE_CURRENT_BINARY_DIR}/src/test.c

> any ideas how I can make sure Lex ran first? secondly,how can i pass my -L and -d options to lex (like I am doing in my normal, pre-cmake version of this makefile)

The docs says:
FLEX_TARGET(Name FlexInput FlexOutput [COMPILE_FLAGS <string>])

I assume you can do:

FLEX_TARGET(Test ../src/test.l  ${CMAKE_CURRENT_BINARY_DIR}/src/test.c COMPILE_FLAGS "-L xxx -D xxx")

-- 
Best regards/Schöne Grüße

Martin

A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?

()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments

This mail was not scanned before sending.
It was sent from a secure Linux desktop.


More information about the CMake mailing list