Merge lp:~compiz-team/compiz/compiz.fix_1082633 into lp:compiz/0.9.9

Proposed by Sam Spilsbury
Status: Merged
Approved by: Daniel van Vugt
Approved revision: 3482
Merged at revision: 3482
Proposed branch: lp:~compiz-team/compiz/compiz.fix_1082633
Merge into: lp:compiz/0.9.9
Diff against target: 49 lines (+12/-10)
2 files modified
src/CMakeLists.txt (+3/-1)
src/tests/CMakeLists.txt (+9/-9)
To merge this branch: bzr merge lp:~compiz-team/compiz/compiz.fix_1082633
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+136041@code.launchpad.net

Commit message

Set the include and link directories to non-relative paths, fix coverage target

(LP: #1082633)

Description of the change

Set the include and link directories to non-relative paths, fix coverage target

(LP: #1082633)

To post a comment you must log in.
3482. By Sam Spilsbury

Fix stupid typo

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

It works. But why the need to use absolute paths?

review: Needs Information
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Relative paths are more of a pain to maintain if we ever move things around.

COMPIZ_MAIN_SOURCE_DIR and COMPIZ_MAIN_BINARY_DIR are defined in the
parent scope, so they are guaranteed to be available as long as we are
in a subdirectory

On Mon, Nov 26, 2012 at 11:23 AM, Daniel van Vugt
<email address hidden> wrote:
> Review: Needs Information
>
> It works. But why the need to use absolute paths?
> --
> https://code.launchpad.net/~compiz-team/compiz/compiz.fix_1082633/+merge/136041
> Your team Compiz Maintainers is subscribed to branch lp:compiz.

--
Sam Spilsbury

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Also, this:

link_directories (..)

is wrong, since it sets the link directory to the parent /source/
directory. Not that it was really a problem here, but if you ever
needed to link to something in the binary directory above it would
bite you at the wrong time.

Generally speaking it is good practise to always qualify paths with
CMAKE_CURRENT_SOURCE_DIR or a variable with an absolute path, ask
tvoss.

On Mon, Nov 26, 2012 at 12:46 PM, Sam Spilsbury <email address hidden> wrote:
> Relative paths are more of a pain to maintain if we ever move things around.
>
> COMPIZ_MAIN_SOURCE_DIR and COMPIZ_MAIN_BINARY_DIR are defined in the
> parent scope, so they are guaranteed to be available as long as we are
> in a subdirectory
>
> On Mon, Nov 26, 2012 at 11:23 AM, Daniel van Vugt
> <email address hidden> wrote:
>> Review: Needs Information
>>
>> It works. But why the need to use absolute paths?
>> --
>> https://code.launchpad.net/~compiz-team/compiz/compiz.fix_1082633/+merge/136041
>> Your team Compiz Maintainers is subscribed to branch lp:compiz.
>
>
>
> --
> Sam Spilsbury

--
Sam Spilsbury

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

On the contrary, the opposite is usually true. Relative .. paths are immune to changes above them. As for changes to directories at the same level, both approaches are equally fragile for assuming rect/region/timer etc always exist at the same level under COMPIZ_MAIN_SOURCE_DIR. However relative paths have the benefits of simplicity and never requiring some variable to be maintained.

Yes, the src/*/CMakeLists.txt need improving to solve this problem however using absolute paths via variables does not help the situation at all.

That said, this proposal only makes the situation slightly worse. Still needs major clean up later either way.

review: Approve
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

On Mon, Nov 26, 2012 at 12:57 PM, Daniel van Vugt
<email address hidden> wrote:
> Review: Approve
>
> On the contrary, the opposite is usually true. Relative .. paths are immune to changes above them. As for changes to directories at the same level, both approaches are equally fragile for assuming rect/region/timer etc always exist at the same level under COMPIZ_MAIN_SOURCE_DIR. However relative paths have the benefits of simplicity and never requiring some variable to be maintained.

http://www.cmake.org/pipermail/cmake/2009-November/033051.html

> --
> https://code.launchpad.net/~compiz-team/compiz/compiz.fix_1082633/+merge/136041
> Your team Compiz Maintainers is subscribed to branch lp:compiz.

--
Sam Spilsbury

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I have not yet seen CMake mess up relative paths myself. If it does then that should be considered a bug.

All CMake has to do is translate a bunch of macros and dependencies into regular Make (GNU Make). And Make has always been designed to operate primarily on the current directory using relative paths. That's the rule rather than an exception. If CMake can't get this right then I'm a bit concerned for CMake.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/CMakeLists.txt'
2--- src/CMakeLists.txt 2012-11-14 10:17:09 +0000
3+++ src/CMakeLists.txt 2012-11-25 04:44:19 +0000
4@@ -1,6 +1,8 @@
5+set (COMPIZ_MAIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
6+set (COMPIZ_MAIN_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
7+
8 include (CompizBcop)
9
10-
11 add_subdirectory( string )
12 add_subdirectory( logmessage )
13 add_subdirectory( timer )
14
15=== modified file 'src/tests/CMakeLists.txt'
16--- src/tests/CMakeLists.txt 2012-11-15 05:48:31 +0000
17+++ src/tests/CMakeLists.txt 2012-11-25 04:44:19 +0000
18@@ -3,17 +3,17 @@
19 )
20
21 include_directories (
22- ..
23- ../rect/include
24- ../region/include
25- ../timer/include
26- ../pluginclasshandler/include
27- ../window/geometry/include
28- ../window/extents/include
29+ ${COMPIZ_MAIN_SOURCE_DIR}
30+ ${COMPIZ_MAIN_SOURCE_DIR}/rect/include
31+ ${COMPIZ_MAIN_SOURCE_DIR}/region/include
32+ ${COMPIZ_MAIN_SOURCE_DIR}/timer/include
33+ ${COMPIZ_MAIN_SOURCE_DIR}/pluginclasshandler/include
34+ ${COMPIZ_MAIN_SOURCE_DIR}/window/geometry/include
35+ ${COMPIZ_MAIN_SOURCE_DIR}/window/extents/include
36 ${COMPIZ_INCLUDE_DIRS}
37 )
38
39-link_directories (..)
40+link_directories (${COMPIZ_MAIN_BINARY_DIR})
41
42 target_link_libraries (compiz_test_outputdevices
43 -Wl,-start-group
44@@ -27,5 +27,5 @@
45 ${GTEST_BOTH_LIBRARIES}
46 )
47
48-compiz_discover_tests(compiz_test_outputdevices COVERAGE compiz_test_outputdevices)
49+compiz_discover_tests(compiz_test_outputdevices COVERAGE compiz_core)
50

Subscribers

People subscribed via source and target branches