I am trying to convert a Makefile project to cmake.
My project has an executable which gets built and linked to both an internal shared library, and an external shared library (there are dependencies in the executable to both).
Here is my old Makefile (generalised):
Include = -I$(PROJ_DIRECTORY)/include -I/${EXTERN}/lnInclude
Library = -L$(PROJ_DIRECTORY)/build -lshared -L$(EXTERN_LIBBIN) -lextern
CPPFLAGS = -D_GLIBCXX_DEBUG -DProjectRescource=$(PROJ_DIRECTORY)/resources -O0 -g3 -Wall -c -fpermissive -std=c++0x -fPIC -MMD -MP
CCC = g++
TARGET = ExecutableName
all: $(TARGET)
clean:
rm -f $(TARGET).o $(TARGET).d $(TARGET)
$(TARGET) : $(TARGET).o
$(CCC) -o $(TARGET) $(TARGET).o $(Library)
$(TARGET).o :
$(CCC) $(Include) $(CPPFLAGS) $(TARGET).cpp
Here is my attempt at CMakeLists.txt (generalised):
include_directories(${PROJECT_SOURCE_DIR}/include/)
add_executable(test1 test1.cpp)
set (CMAKE_CXX_FLAGS "-D_GLIBCXX_DEBUG -DProjectRescource=${PROJECT_SOURCE_DIR}/resources -O0 -g3 -Wall -fpermissive -std=c++0x -fPIC -MMD -MP")
include_directories($ENV{EXTERN_INCLUDE}/lnInclude)
target_link_libraries(test1 "$ENV{EXTERN_LIBBIN}/libextern.so" Project)
When I run the executable, calls to functions defined in the include directory return -nan. Does anyone know why?