Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cmake .
- -- The C compiler identification is GNU
- -- Checking whether C compiler has -isysroot
- -- Checking whether C compiler has -isysroot - yes
- -- Check for working C compiler: /usr/bin/gcc
- -- Check for working C compiler: /usr/bin/gcc -- works
- -- Detecting C compiler ABI info
- -- Detecting C compiler ABI info - done
- -- Found BISON: /usr/bin/bison
- -- Found FLEX: /usr/bin/flex
- -- Looking for _assert_true in cmockery
- -- Looking for _assert_true in cmockery - found
- -- Configuring done
- -- Generating done
- -- Build files have been written to: /Users/sebastian/projects/development/pkgparse
- $ make
- [ 20%] [BISON][pkgbuild_parser] Building parser with bison 2.3
- Scanning dependencies of target pkgparse
- [ 40%] Building C object CMakeFiles/pkgparse.dir/pkgbuild.o
- [ 60%] Building C object CMakeFiles/pkgparse.dir/symbol.o
- [ 80%] Building C object CMakeFiles/pkgparse.dir/utility.o
- [100%] Building C object CMakeFiles/pkgparse.dir/pkgbuild_parse.o
- Linking C shared library libpkgparse.dylib
- Undefined symbols:
- "_yyerror", referenced from:
- _yyparse in pkgbuild_parse.o
- _yyparse in pkgbuild_parse.o
- "_yylex", referenced from:
- _yyparse in pkgbuild_parse.o
- "_yyin", referenced from:
- _yyin$non_lazy_ptr in pkgbuild_parse.o
- ld: symbol(s) not found
- collect2: ld returned 1 exit status
- make[2]: *** [libpkgparse.dylib] Error 1
- make[1]: *** [CMakeFiles/pkgparse.dir/all] Error 2
- make: *** [all] Error 2
- $ cat CMakeLists.txt
- project(pkgparse C)
- find_package(BISON)
- find_package(FLEX)
- BISON_TARGET(pkgbuild_parser pkgbuild_parse.y ${CMAKE_CURRENT_BINARY_DIR}/pkgbuild_parse.c)
- FLEX_TARGET(pkgbuild_scanner pkgbuild_scanner.l ${CMAKE_CURRENT_BIANRY_DIR}/pkgbuild_scanner.c)
- ADD_FLEX_BISON_DEPENDENCY(pkgbuild_scanner pkgbuild_parser)
- set(pkgparse_SRCS
- pkgbuild.c
- symbol.c
- utility.c
- ${BISON_pkgbuild_parser_OUTPUTS}
- ${FLEX_pkgbuild_parser_OUTPUTS}
- )
- #include_directories(${CMAKE_CURRENT_BINARY_DIR})
- add_library(pkgparse SHARED ${pkgparse_SRCS})
- include(CheckLibraryExists)
- check_library_exists(cmockery _assert_true "" HAVE_CMOCKERY)
- # Unit tests
- if(HAVE_CMOCKERY)
- add_custom_target(test COMMAND ${CMAKE_TEST_COMMAND})
- add_executable(test_runner EXCLUDE_FROM_ALL test_runner.c pkgbuild_test.c symbol_test.c utility_test.c)
- add_test(test_runner test_runner)
- add_dependencies(test test_runner)
- find_library(cmockery_LIBRARY NAMES cmockery)
- set(cmockery_PROCESS_LIBS cmockery_LIBRARY cmockery_LIBRARIES)
- target_link_libraries(test_runner pkgparse cmockery)
- endif(HAVE_CMOCKERY)
Add Comment
Please, Sign In to add comment