0

My compile command is:

cc -std=c11 -I include src/main.c lib/libflatccrt.a -o run_file

Which has to havelib/libflatccrt.a init to compile. How do you add this file to CMake? Right now my CMakeLists.txt is:

cmake_minimum_required (VERSION 2.6)
project (MyProject)
include_directories(include)
file(GLOB SOURCES "src/*.c")
add_executable(MyProject ${SOURCES})
user45189
  • 169
  • 1
  • 9
  • adding to my end of a CMakeLists.txt file, this command: target_link_libraries(MyProject lib/libflatccrt.a) "cmake" would compile, but "make" command says: cannot find -llib/libflatccrt.a – user45189 Nov 15 '18 at 21:14
  • 1
    You need to provide absolute path to the library, like in that question: https://stackoverflow.com/questions/14077611/how-do-i-tell-cmake-to-link-in-a-static-library-in-the-source-directory. – Tsyvarev Nov 15 '18 at 21:52
  • Yes, I did provide exact path to it and now it does find it. Thank you! – user45189 Nov 15 '18 at 21:59

0 Answers0