I'm trying to build my application. It's organized as following:
-ClipsCore
|-agenda.c
|-agenda.h
|-envrnmnt.c
|-engrnmnt.h
|-clips.h
|-....
-src
|-clipsDemo.cpp
-build
-CMakeLists.txt
Here is my CMakeLists.txt
cmake_minimum_required (VERSION 2.8)
project (clipsDemo)
set(MY_CPP_FILES src/clipsDemo.cpp)
file(GLOB CLIPS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/ClipsCore/*.c)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ClipsCore)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/ClipsCore)
add_library(clipslib ${CLIPS_SRC})
add_executable(${PROJECT_NAME} ${MY_CPP_FILES})
target_link_libraries(${PROJECT_NAME} clipslib)
When I build, I got errors like the following:
undefined reference to `CreateEnvironment()'
Although this function found in envrnmnt.c file which should be linked to the executable as far as I understand. I tried to build the ClipsCore library using add_library
then tried to link it to the executable using target_link_libraries
.
What is wrong with my CMakeLists.txt?