Reputation: 133
I followed this answer to create a CMakeLists.txt for a simple Makefile
Makefile
CC = g++
INCFLAGS = -I/usr/local/include/embree3
LDFLAGS = -L"/usr/local/lib/" -lembree3
RM = /bin/rm -f
all:
$(CC) -o main main.cpp $(INCFLAGS) $(LDFLAGS)
clean:
$(RM) *.o main
CMakeLists.txt
cmake_minimum_required(VERSION 3.1.0)
project(some_project)
include_directories(/usr/local/include/embree3) # -I flags for compiler
link_directories(/usr/local/lib/) # -L flags for linker
add_executable(main main.cpp)
target_link_libraries(main embree) # -l flags for linking prog target
The Makefile compiles properly and the executable runs without any issues. And to use the cmake file, I do the following (assuming I am in source directory)
The make
in step 4 throws the following error
main.cpp:4:10: fatal error: 'embree3/rtcore.h' file not found
#include <embree3/rtcore.h>
^~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/main.dir/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/main.dir/all] Error 2
make: *** [all] Error 2
Upvotes: 0
Views: 707
Reputation: 614
Ok, so following your answer to my comments, the problem is that since you starts your include instruction by embree3 (which make sense to avoid names conflict), cmake should have as include directory the directory containing the embree3 installation, not the embree3 folder itself.
This is why include_directories(/usr/local/include) is working instead of include_directories(/usr/local/include/embree3).
Upvotes: 1