Hello,

I need some advices regarding FreeRDP & cmake.
I'd like to add a rule for generating files from Flex & Bison.

The parser.y and lexer.l files are located in libfreerdp/locale/
So I add that in the libfreerdp/locale/CMakeLists.txt :

<code>
if (WITH_SOME_VAR)
        find_package(BISON REQUIRED)
        find_package(FLEX REQUIRED)
        bison_target(parser parser.y parser.c )
        flex_target(scanner lexer.l lexer.c)
         ADD_FLEX_BISON_DEPENDENCY(scanner parser)

        set(${MODULE_PREFIX}_PARSER_SRCS
              ${BISON_parser_OUTPUTS}
              ${FLEX_lexer_OUTPUTS}
              )

        set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} 
${${MODULE_PREFIX}_PARSER_SRCS})
endif()
</code>

But when I run "cmake -DWITH_SOME_VAR .",  I've got this error message :
CMake Error at libfreerdp/CMakeLists.txt:293 (add_library):
   Cannot find source file:

     locale/parser.c

To me, it is normal that the parser.c file cannot be find (because it 
have to be generated at compile time by bison) but how can I tell cmake 
that this file will be generated later ?

For info, if I create a new project with CMakeLists.txt (see below) all 
work fine (at least for the cmake generating part), so I think my 
problem is my lack of knowledge of the FreeRDP cmake structure (and 
cmake itself by the way).

Is someone can tell me what I do wrong ?

<code>
project(test)

# find required packages
find_package(FLEX REQUIRED)
find_package(BISON REQUIRED)

# create parser and scanner sources
bison_target(parser parser.y parser.c)
flex_target(scanner scanner.l scanner.c)
# probably the scanner depends on headers from the parser
add_flex_bison_dependency(scanner parser)

# define all sources here
set(lib_sources
   a.c
   b.c
   ${BISON_parser_OUTPUTS}
   ${FLEX_scanner_OUTPUTS})

# set up include directories
include_directories(
   ${CMAKE_CURRENT_SOURCE_DIR}
   ${CMAKE_CURRENT_BINARY_DIR})

# create the library
add_library(test ${lib_sources})
</code>

Regards,

Vincent.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
FreeRDP-devel mailing list
FreeRDP-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freerdp-devel

Reply via email to