I have this directory struct:
├── bin
├── build
├── calculator
│ ├── build
│ ├── calculator.c
│ └── CMakeLists.txt
├── CMakeLists.txt
├── compcalc
│ ├── build
│ ├── CMakeLists.txt
│ ├── compcalc.c
│ └── compcalc.h
├── include
│ └── calculator.h
├── obj
│ ├── libcompcalc.a
│ └── libsimpcalc.a
├── simpcalc
│ ├── build
│ ├── CMakeLists.txt
│ ├── simpcalc.c
│ └── simpcalc.h
simpcalc
and compcalc
are built fine and after running "make install" the files are put in the /obj
directory.
But when I try to build calculator i get the following errors:
/usr/bin/ld: cannot find -lsimpcalc
/usr/bin/ld: cannot find -lcompcalc
The CMakefile.txt
is:
cmake_minimum_required(VERSION 2.8.9)
project(calculator)
set(CMAKE_BUILD_TYPE Release)
include_directories(../include)
file(GLOB SOURCES "*.c")
set ( PROJECT_LINK_LIBS libsimpcalc.a libcompcalc.a)
link_directories({calculator_SOURCE_DIR}/../obj )
add_executable(calculator ${SOURCES})
target_link_libraries(calculator ${PROJECT_LINK_LIBS} )
Not sure why it is looking for simpcalc
when in the CMakeLists.txt
I specifically say libsimpcalc.a
.