Thread: Cannot generate cmake for pcre in c

  1. #1
    Registered User
    Join Date
    Jun 2018
    Posts
    10

    Cannot generate cmake for pcre in c

    Greetings to all.

    First of all, in my ubuntu 18.04 system I installed libpcre3 and libpcre3-dev in order to obtain the non-standard C pcre library, however. After generating a Cmake file "source code is proven to work and is only one residing on the src folder on my project" I get the following error after executing my generated makefile.

    Code:
    [ 50%] Building C object CMakeFiles/main.dir/src/main.c.o
    [100%] Linking C executable main
    /usr/bin/ld: cannot find -lregexlist
    /usr/bin/ld: cannot find -lregexlist.c
    collect2: error: ld returned 1 exit status
    CMakeFiles/main.dir/build.make:94: recipe for target 'main' failed
    make[2]: *** [main] Error 1
    CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/main.dir/all' failed
    make[1]: *** [CMakeFiles/main.dir/all] Error 2
    Makefile:83: recipe for target 'all' failed
    make: *** [all] Error 2
    diego@diego-Swift-SF113-31:~/Documents/desarrollo/regex/c/ejemplo-1/build$
    The Cmake in question is the following

    Code:
    cmake_minimum_required(VERSION 2.8.9)
    project(directory_test)
    
    # Incluye los encabezados .h
    #include_directories(include)
    
    # Agrega fuentes
    file(GLOB SOURCES "src/*.c")
    
    # Crea el ejecutable
    add_executable(main ${SOURCES})
    
    # Agrega librería externa
    target_link_libraries(main regexlist regexlist.c -lpcre)
    
    # Agrega flags de compilación
    target_compile_options(main PUBLIC -Wall)
    Any help would be greatly appreciated.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    You appear to believe that there is a library called "regexlist". Is there a reason for that belief?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. CMake - Specifying Compiler flags to be run
    By Asymptotic in forum C Programming
    Replies: 0
    Last Post: 07-02-2018, 10:51 PM
  2. Cmake file dependancy
    By King Mir in forum C++ Programming
    Replies: 6
    Last Post: 12-26-2017, 08:03 AM
  3. PCRE string issue
    By aboosoyeed in forum C Programming
    Replies: 6
    Last Post: 03-23-2012, 06:59 PM
  4. i need help with cmake, BISON and FLEX, i am willing to pay
    By Yakir Manor in forum Projects and Job Recruitment
    Replies: 1
    Last Post: 01-17-2012, 04:54 PM
  5. Replies: 8
    Last Post: 05-01-2011, 07:05 AM

Tags for this Thread