[cmake-developers] [CMake 0014876]: <OBJECT_DIR> not set correctly after upgrade to CMake 2.8.12.2

Mantis Bug Tracker mantis at public.kitware.com
Tue Apr 15 08:32:26 EDT 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14876 
====================================================================== 
Reported By:                raspy
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14876
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-04-15 08:32 EDT
Last Modified:              2014-04-15 08:32 EDT
====================================================================== 
Summary:                    <OBJECT_DIR> not set correctly after upgrade to
CMake 2.8.12.2
Description: 
I use a custom compilation command, which requires to use OBJECT_DIR, like this:

SET(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <FLAGS>
-fr=<OBJECT_DIR> <SOURCE>")

<OBJECT_DIR> used to be set up correctly using CMake 2.8.10.2, i.e.:

[  0%] Building C object libs/acelp/CMakeFiles/acelp.dir/src/acelp.obj
cd /path/to/libs/acelp && /path/to/cl6x --gcc  -o3 -DNDEBUG -I/path/to/acelp
-I/path/to/include -I/path/to/acelp/inc --display_error_number -pdsr230 -pdsr14
-pdsw225 -pc -mv6740 --preinclude=sw_model.h -o3 -pm
-fr=CMakeFiles/acelp.dir/src /path/to/acelp/src/acelp.c

However, after upgrade to CMake 2.8.12.2 it seems that OBJECT_DIR is missing
directory of the source file which is beneath ${CMAKE_CURRENT_SOURCE_DIR}:

[  0%] Building C object libs/acelp/CMakeFiles/acelp.dir/src/acelp.obj
cd /path/to/libs/acelp && /path/to/cl6x --gcc  -o3 -DNDEBUG
--include_path=/path/to/acelp --include_path=/path/to/include
--include_path=/path/to/acelp/inc --display_error_number -pdsr230 -pdsr14
-pdsw225 -pc -mv6740 --preinclude=sw_model.h -o3 -pm -fr=CMakeFiles/acelp.dir
/path/to/acelp/src/acelp.c

Note that -fr option is now missing /src part, which makes object file created
as libs/acelp/CMakeFiles/acelp.dir/acelp.obj instead of
libs/acelp/CMakeFiles/acelp.dir/src/acelp.obj and linking then fails due to not
found objects.


Steps to Reproduce: 
Create a custom compilation rule which uses <OBJECT_DIR> and a source file in
subdirectory:

$ cat CMakeLists.txt
project(hello C)
set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <FLAGS>
-fr=<OBJECT_DIR> <SOURCE>")
add_executable(hello src/hello.c)

$ cat src/hello.c
int main(int argc, char *argv[])
{
    return 0;
}

Configure project with TI's cl6x compiler:

$ /path/to/CMake/2.8.12.2/linux/i386/bin/cmake -DCMAKE_C_COMPILER=/path/to/cl6x
.

Run compilation:

$ make VERBOSE=1
...
[100%] Building C object CMakeFiles/hello.dir/src/hello.c.o
/path/to/cl6x    -fr=CMakeFiles/hello.dir /path/to/src/hello.c
Linking C executable hello
/path/to/CMake/2.8.12.2/linux/i386/bin/cmake -E cmake_link_script
CMakeFiles/hello.dir/link.txt --verbose=1
/path/to/cl6x  --run_linker --output_file=hello --map_file=hello.map     
CMakeFiles/hello.dir/src/hello.c.o
<Linking>
"/tmp/08605AX1MaL", line 6: error: cannot find file
   "CMakeFiles/hello.dir/src/hello.c.o"
fatal error: no input files


====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-04-15 08:32 raspy          New Issue                                    
======================================================================



More information about the cmake-developers mailing list