Greetings,
I am trying to generate a platform specific file by copying it from
the source tree into a specific directory in the separate
out-of-source build tree. The file generation works fine.
When I try the following cmake code:
set(target_dir ${CMAKE_BINARY_DIR}/nail/platform)
message("target_dir: ${target_dir}")
include_directories(${target_dir})
where message displays:
target_dir: /home/rcarter/nail/core/build/g++7.Debug/nail/platform
That's what I want and the generated files exist in that directory.
However, I get the following error:
FAILED: nail/CMakeFiles/nail_core.dir/platform/time.cpp.o
/usr/local/bin/g++7 -Dnail_core_EXPORTS -I../../ -Inail/platform -g -O
-std=c++17 -fno-omit-frame-pointer -fstack-protector -Wall -Wextra
-fvisibility=hidden -fvisibility-inlines-hidden -fPIC -MD -MT
nail/CMakeFiles/nail_core.dir/platform/time.cpp.o -MF
nail/CMakeFiles/nail_core.dir/platform/time.cpp.o.d -o
nail/CMakeFiles/nail_core.dir/platform/time.cpp.o -c nail/platform/time.cpp
nail/platform/time.cpp:2:10: fatal error: nail/platform/time.hpp: No
such file or directory
Evidently the include_directories() command is converting the
the supplied absolute path to a relative path (-Inail/platform).
What should I do to get that include directory in the
build tree added correctly to the includes? I suppose I could
add it manually to the CXX flags? What's the best cmake
friendly way to handle this?
Thanks,
Russell
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake