long paths generated

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

long paths generated

Lode Leroy
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

--

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:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: long paths generated

fostersanders
This post has NOT been accepted by the mailing list yet.
Hey I suggest that you try Long Path Tool.

It´s a great tool to to fix the message that say "The specified file or folder name is too long. The URL path for all files and folders must be 260 character..."

I used it and had a good and fast solution to my problem.

Highly recommendable.