[CMake] long paths generated
Lode Leroy
lode.leroy at gmail.com
Mon Sep 1 03:55:09 EDT 2014
Hello cmake users,
I'm trying to convert a big project from make to cmake, and I'm seeing
paths like
/home/lode/prj/test/cmake/ext/build/lib1/CMakeFiles/lib1.dir/home/lode/prj/test/cmake/ext/prj2/src
where I would want to see
/home/lode/prj/test/cmake/ext/build/lib1/CMakeFiles/lib1.dir/prj2/src
ie. I do not want the base directory repeated in the generated paths.
I can see that it's because of the "../" in the CMakeLists, but is there a
way of preventing this?
(I'll be building on windows, and the source dirs can have quite long names)
I had hoped that "set(CMAKE_SOURCE_DIR /home/lode/prj/test/cmake/ext)"
would do this for me,
as all files I will be using are below this folder, but the
"top-level-CMakeLists is not in the "top-level directory...
The structure I am trying to implement is illustrated below. I have the
following files:
prj1/mak/CMakeLists.txt
prj1/src/main1.c
prj2/mak/CMakeLists.txt
prj2/src/lib1.c
with this content:
========== prj1/mak/CMakeLists.txt ==========
add_subdirectory(../../prj2/mak lib1)
link_libraries(lib1)
add_executable(main1 ../src/main1.c)
========== prj1/src/main1.c ==========
int main(int argc, char* argv[]) {
f1();
}
========== prj2/mak/CMakeLists.txt ==========
add_library(lib1 ../src/lib1.c)
========== prj2/src/lib1.c ==========
int f1() {
return 0;
}
========== ==========
now when building in "/home/lode/prj/test/cmake/ext"
using cmake, as follows:
mkdir build
cd build
cmake ../prj1/mak
I get sub-directories that include the full path of the top of my source
tree...
find lib1
lib1/
lib1/CMakeFiles
lib1/CMakeFiles/CMakeDirectoryInformation.cmake
lib1/CMakeFiles/lib1.dir
lib1/CMakeFiles/lib1.dir/build.make
lib1/CMakeFiles/lib1.dir/cmake_clean.cmake
lib1/CMakeFiles/lib1.dir/cmake_clean_target.cmake
lib1/CMakeFiles/lib1.dir/depend.make
lib1/CMakeFiles/lib1.dir/DependInfo.cmake
lib1/CMakeFiles/lib1.dir/flags.make
lib1/CMakeFiles/lib1.dir/home
lib1/CMakeFiles/lib1.dir/home/lode
lib1/CMakeFiles/lib1.dir/home/lode/prj
lib1/CMakeFiles/lib1.dir/home/lode/prj/test
lib1/CMakeFiles/lib1.dir/home/lode/prj/test/cmake
lib1/CMakeFiles/lib1.dir/home/lode/prj/test/cmake/ext
lib1/CMakeFiles/lib1.dir/home/lode/prj/test/cmake/ext/prj2
lib1/CMakeFiles/lib1.dir/home/lode/prj/test/cmake/ext/prj2/src
lib1/CMakeFiles/lib1.dir/link.txt
lib1/CMakeFiles/lib1.dir/progress.make
lib1/CMakeFiles/progress.marks
lib1/cmake_install.cmake
lib1/Makefile
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140901/527fc4eb/attachment-0001.html>
More information about the CMake
mailing list