Bug 281565

Summary: Can not compile single file from subdirectory
Product: [Applications] kdevelop Reporter: Sergey Vidyuk <sir.vestnik>
Component: Build tools: CMakeAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: mateusz
Priority: NOR    
Version: git master   
Target Milestone: 4.2.3   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Example project

Description Sergey Vidyuk 2011-09-07 16:54:40 UTC
Created attachment 63487 [details]
Example project

Version:           git master (using KDE 4.7.0) 
OS:                Linux

Attempt to compile single file fails if file is located in a subdirectory added to a main project using cmake add_subdirectory() function. Make is executed in wrong folder.

Reproducible: Always

Steps to Reproduce:
1 Open a project attached
2 Modify timestamp on foo/bar2.cpp
3 Remove everything from "Project selection"
4 Add foo/bar2.cpp to Project selection
5 Pres F8 or "Build selection" button

Actual Results:  
Got the following output in build toolview:
/home/vestnik/Development/test/kdev4bug/build> make bar2.o
make: *** No rule to make target `bar2.o'.  Stop.
*** Failed ***

Expected Results:  
"make bar.o" command should be executed from the "foo" subdirectory of the build tree instead of root of the build tree and should compile bar2.cpp successfully.
Comment 1 Aleix Pol 2011-09-12 02:43:09 UTC
Git commit 5ff08ca46fea2c9e9b263f155dda68aeb3eb4412 by Aleix Pol.
Committed on 12/09/2011 at 04:40.
Pushed by apol into branch 'master'.

Make it possible again to compile just one file, use CMakeFolderItem
instead of ProjectFolderItem to pass the relative path.

BUG: 281565

M  +8    -6    projectbuilders/cmakebuilder/cmakebuilder.cpp

http://commits.kde.org/kdevelop/5ff08ca46fea2c9e9b263f155dda68aeb3eb4412
Comment 2 Mateusz Loskot 2011-11-02 22:23:41 UTC
Follow-up mine and Aleix discussion on #kdevelop,
I can reproduce the same problem wiht version 4.2.2 (installed from Linux Mint 11 packages)