MantisBT - CMake | |||||
| View Issue Details | |||||
| ID | Project | Category | View Status | Date Submitted | Last Update |
| 0010816 | CMake | CMake | public | 2010-06-10 14:38 | 2016-06-10 14:31 |
| Reporter | Stingray84 | ||||
| Assigned To | Brad King | ||||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | closed | Resolution | moved | ||
| Platform | OS | OS Version | |||
| Product Version | CMake-2-8 | ||||
| Target Version | Fixed in Version | ||||
| Summary | 0010816: Adding out of tree dependencies are broken because of relative vs. absolute paths | ||||
| Description | It took me a while to figure out what was going on, but it turns out that sometimes the generated Makefile targets don't get created properly when using out of tree dependencies. Here's the situation. I have a project (say A) that needs to use a library that's generated from an external CMake project (externB). So, in my CMakeLists.txt for A, I have: set(EXTERNAL_BUILD_DIR ${PROJECT_SOURCE_DIR}/external/ ) add_subdirectory(../../../externB ${EXTERNAL_BUILD_DIR}/externB) add_executable(A A.cc) target_link_libraries(A externB) Now, if I build A in a "build" directory. mkdir build cmake .. make I get an error similar to: *** No rule to make target `../external/externB/CMakeFiles/externB.dir/all', needed by `CMakeFiles/A.dir/all'. Stop. After looking around in the generated Makefiles, I found out that this occurs because the target: `../external/externB/CMakeFiles/externB.dir/all' is generated with the name: `{absolute_path}/external/externB/MakeFiles/externB.dir/all' So, to solve this, I needed to change: set(EXTERNAL_BUILD_DIR ${PROJECT_SOURCE_DIR}/external/ ) to: set(EXTERNAL_BUILD_DIR ${PROJECT_BINARY_DIR}/external/ ) But, this means that if for some reason you want the out-of-tree source to build somewhere else that's not in the binary tree, CMake will generate the wrong Makefile targets and fail. | ||||
| Steps To Reproduce | |||||
| Additional Information | |||||
| Tags | No tags attached. | ||||
| Relationships | |||||
| Attached Files | https://public.kitware.com/Bug/file/3179/bug_10816_example.tar.gz | ||||
| Issue History | |||||
| Date Modified | Username | Field | Change | ||
| 2010-06-10 14:38 | Stingray84 | New Issue | |||
| 2010-06-10 14:57 | Bill Hoffman | Status | new => assigned | ||
| 2010-06-10 14:57 | Bill Hoffman | Assigned To | => Brad King | ||
| 2010-06-10 15:11 | Brad King | Note Added: 0020980 | |||
| 2010-06-10 16:25 | Stingray84 | File Added: bug_10816_example.tar.gz | |||
| 2012-08-13 10:44 | Brad King | Status | assigned => backlog | ||
| 2012-08-13 10:44 | Brad King | Note Added: 0030555 | |||
| 2016-06-10 14:28 | Kitware Robot | Note Added: 0041710 | |||
| 2016-06-10 14:28 | Kitware Robot | Status | backlog => resolved | ||
| 2016-06-10 14:28 | Kitware Robot | Resolution | open => moved | ||
| 2016-06-10 14:31 | Kitware Robot | Status | resolved => closed | ||
| Notes | |||||
|
|
|||||
|
|
||||
|
|
|||||
|
|
||||
|
|
|||||
|
|
||||