g ++ (Ubuntu / Linaro 4.5.2-8ubuntu4) 4.5.2
I have a static library called sdpAPI.a
I am trying to link my cpp file with it using cmake.
My CMakeLists.txt looks like this:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(demo_project CXX) IF(CMAKE_COMPILER_IS_GNUCXX) SET(CMAKE_C_FLAGS "-Wall -Wextra -Wunreachable-code -O0 -D_DEBUG -ggdb -m32") ENDIF(CMAKE_COMPILER_IS_GNUCXX) INCLUDE_DIRECTORIES(sdpapi) LINK_DIRECTORIES(~/projects/test_sdp/sdpapi) SET(source_files main.cpp) SET(libs sdpAPI) ADD_EXECUTABLE(demo ${source_files}) TARGET_LINK_LIBRARIES(demo ${libs})
And my sdpAPI.a is in this directory test_sdp / sdpapi / sdpAPI.a
The error I am getting is the following:
[100%] Building CXX object CMakeFiles/demo.dir/main.cpp.o Linking CXX executable demo /usr/bin/ld: cannot find -lsdpAPI collect2: ld returned 1 exit status make[2]: *** [demo] Error 1 make[1]: *** [CMakeFiles/demo.dir/all] Error 2 make: *** [all] Error 2
Can anyone see something obvious that I'm doing wrong.
source share