Bug 357574

Summary: KDevelop can't find tests/executables when EXECUTABLE_OUTPUT_PATH is set
Product: [Applications] kdevelop Reporter: nholthaus
Component: Build tools: CMakeAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: aleixpol
Priority: NOR    
Version First Reported In: 4.7.1   
Target Milestone: ---   
Platform: RedHat Enterprise Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 5.2.0
Sentry Crash Report:

Description nholthaus 2016-01-05 12:54:53 UTC
I'm trying to use the KDevelop Unit-test window to run my projects tests, but KDevelop gives the following error when I try to run them:

    *** Could not start program '[path where it thinks my test is]'. Make sure that the path is specified correctly ***

However, I'm using the cmake variable EXECUTABLE_OUTPUT_PATH to organize my project, and KDevelop's [path where it thinks my test is] is set to the default executable output path instead.

Is there some way to make KDevelop aware of where the test is, possible through some CMake property on the executable target? I've tried INSTALL_RPATH, LOCATION, and setting the WORKING_DIRECTORY on the ADD_TEST command, but none of those things helped.

Note: I have the same problem running the executables in the debugger, but I can work around it by manually specifying the target location in the dialog box. Unit tests, however, don't seem to have such an override.


Reproducible: Always

Steps to Reproduce:
1. use executable_path cmake variable to move output location of an exectuable/test
2. Attempt to run the test, or debug executable
3.

Actual Results:  
error message:     *** Could not start program '[path where it thinks my test is]'. Make sure that the path is specified correctly ***

Expected Results:  
test should be found and run properly
Comment 1 Kevin Funk 2016-01-05 13:01:20 UTC
Aleix: Can you check? I thought this was fixed?

See https://bugs.kde.org/show_bug.cgi?id=232447
Comment 2 Aleix Pol 2017-07-12 12:57:47 UTC
Git commit 0552ff770efa1022f5d469c90683f5a6a8873908 by Aleix Pol.
Committed on 12/07/2017 at 12:57.
Pushed by apol into branch 'master'.

Use the executable path offered by the cmake server

M  +1    -1    projectmanagers/cmake/cmakemanager.cpp
M  +5    -1    projectmanagers/cmake/cmakemodelitems.cpp
M  +4    -1    projectmanagers/cmake/cmakemodelitems.h
M  +1    -0    projectmanagers/cmake/cmakeprojectdata.h
M  +5    -1    projectmanagers/cmake/cmakeserverimportjob.cpp
A  +7    -0    projectmanagers/cmake/tests/manual/randomexe/CMakeLists.txt
A  +6    -0    projectmanagers/cmake/tests/manual/randomexe/main.cpp     [License: UNKNOWN]  *
A  +3    -0    projectmanagers/cmake/tests/manual/randomexe/randomexe.kdev4
M  +11   -0    projectmanagers/cmake/tests/test_cmakemanager.cpp
M  +1    -0    projectmanagers/cmake/tests/test_cmakemanager.h

The files marked with a * at the end have a non valid license. Please read: http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


https://commits.kde.org/kdevelop/0552ff770efa1022f5d469c90683f5a6a8873908
Comment 3 Aleix Pol 2017-07-12 15:38:42 UTC
Git commit 3c1fd1f09e6002994c17c78ac3efe792bf560fe9 by Aleix Pol.
Committed on 12/07/2017 at 15:38.
Pushed by apol into branch 'master'.

Properly initialize a test's executable

M  +1    -1    projectmanagers/cmake/cmakemanager.cpp
M  +1    -1    projectmanagers/cmake/cmakeprojectdata.h
M  +1    -1    projectmanagers/cmake/cmakeutils.cpp
M  +15   -20   projectmanagers/cmake/testing/ctestutils.cpp
M  +1    -1    projectmanagers/cmake/testing/ctestutils.h
M  +2    -1    projectmanagers/cmake/tests/manual/randomexe/CMakeLists.txt
M  +15   -1    projectmanagers/cmake/tests/test_cmakemanager.cpp

https://commits.kde.org/kdevelop/3c1fd1f09e6002994c17c78ac3efe792bf560fe9