Re: [cmake-developers] Modifying RPATH feature to run tests uninstalled

2012-03-05 Thread Stephen Kelly
Brad King wrote:

 On Sun, Mar 4, 2012 at 5:18 PM, Stephen Kelly
 steve...@gmail.com wrote:
 That's a good start.  However I do not think the logic plays well
 with BUILD_WITH_INSTALL_RPATH as currently written.  If that is
 set then the build tree should end up with the install-tree rpath
 which should be empty if SKIP_INSTALL_RPATH is on.  Therefore
 the relink/chrpath paths should not need to return true always
 when SKIP_INSTALL_RPATH is on.

 Sorry this took so long. I have updated the branch (It is now
 e96c16ae23885be2e66d67291344369585ebfece)
 
 -this-Target-GetPropertyAsBool(INSTALL_RPATH_USE_LINK_PATH);
 +this-Target-GetPropertyAsBool(INSTALL_RPATH_USE_LINK_PATH) 
 +!(for_install  this-Makefile-IsOn(CMAKE_SKIP_INSTALL_RPATH));
 
 s/for_install/linking_for_install/ because BUILD_WITH_INSTALL_RPATH
 should cause the build tree to get the install tree rpath which is
 empty when CMAKE_SKIP_INSTALL_RPATH is ON.

linking_for_install is already part of the boolean expression. I just 
removed the for_install in the latest version of this patch.

 
cm-DefineProperty
 +(CMAKE_SKIP_INSTALL_RPATH, cmProperty::VARIABLE,
 + Do not include RPATHs in the install tree.,
 
 Please update the documentation of both this variable and
 CMAKE_SKIP_RPATH so each references the other.  We want packagers
 using CMAKE_SKIP_RPATH to discover CMAKE_SKIP_INSTALL_RPATH.

Done.

 
 +  this-SetPropertyDefault(SKIP_INSTALL_RPATH, 0);
 
 This is unnecessary because it is not a target-level property.  The
 new SKIP variable is supposed to be a packager's hammer so we cannot
 let projects turn it off for some targets but not others.

Done.

 
 @@ -3625,28 +3627,33 @@ bool cmTarget::NeedRelinkBeforeInstall(const
 char* config)
 ...
 +  if(this-Makefile-IsOn(CMAKE_SKIP_INSTALL_RPATH))
 +{
 +return true;
 +}
 +
// If chrpath is going to be used no relinking is needed.
if(this-IsChrpathUsed(config))
  {
  return false;
  }
 ...
 @@ -4013,28 +4021,33 @@ bool cmTarget::IsChrpathUsed(const char* config)
 ...
 +  if(this-Makefile-IsOn(CMAKE_SKIP_INSTALL_RPATH))
 +{
 +return true;
 +}
 +
// Allow the user to disable builtin chrpath explicitly.
if(this-Makefile-IsOn(CMAKE_NO_BUILTIN_CHRPATH))
  {
  return false;
  }
 
 Drop these tests.  These two methods are about deciding how to rewrite
 the RPATH during installation.  The code below these hunks decides
 whether it is even possible to do.
 
 Just changes to
 
   cmComputeLinkInformation::GetRPath
   cmTarget::HaveInstallTreeRPATH
   cmTarget::GetInstallNameDirForInstallTree
 
 should be enough for the rest of the logic to work.

Done.

e1b4fec8dd73cc675b3a20f2e045c6282c47553a in my gitorious clone contains the 
updated state. It behaved as I expected in all combinations I tested.

I can push it to stage/next whenever.

Thanks,

Steve.


--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Modifying RPATH feature to run tests uninstalled

2012-03-05 Thread Brad King

On 3/5/2012 10:47 AM, Stephen Kelly wrote:

e1b4fec8dd73cc675b3a20f2e045c6282c47553a in my gitorious clone contains the
updated state. It behaved as I expected in all combinations I tested.


Much cleaner, thanks.  Here are some more comments.

  outputRuntime  linking_for_install 
 -this-Target-GetPropertyAsBool(INSTALL_RPATH_USE_LINK_PATH);
 +this-Target-GetPropertyAsBool(INSTALL_RPATH_USE_LINK_PATH) 
 +!this-Makefile-IsOn(CMAKE_SKIP_INSTALL_RPATH);

I think this can be simplified to

  outputRuntime  linking_for_install 
 +!this-Makefile-IsOn(CMAKE_SKIP_INSTALL_RPATH) 
  this-Target-GetPropertyAsBool(INSTALL_RPATH_USE_LINK_PATH);

which is also a more readable order for the logic IMO.

 - This allows for easy running from the build tree.,false,
 + This allows for easy running from the build tree.  To omit RPATH
 + in both the install step, but not the build step, use 
 + CMAKE_SKIP_INSTALL_RPATH,false,

The wording in both the install step looks like a cut-n-paste goober.
Also the sentence should end in a period.

 + is always built with RPATH but installed without RPATH.  This can be 

This is imprecise.  The option installs without RPATH whether or not
the build tree gets an RPATH, but the option does not affect the build
tree by itself.

-Brad
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Modifying RPATH feature to run tests uninstalled

2012-03-05 Thread Stephen Kelly
Brad King wrote:

 Much cleaner, thanks.  Here are some more comments.

Thanks, I'll try to clean up the remaining messiness later when I can give 
it my full attention. With the remaining goobers, clearly I'm not giving it 
enough at the moment :).

Thanks,

Steve.


--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Modifying RPATH feature to run tests uninstalled

2012-03-05 Thread Stephen Kelly
Brad King wrote:

 On 3/5/2012 4:26 PM, Stephen Kelly wrote:
 I updated the branch again. It is now
 635bf50c27aef184bfa1698953dd44361e1fb2f9
 
 Great, thanks.  Please merge to 'next' for testing.
 

Done. Thanks for the review.

Steve.


--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Modifying RPATH feature to run tests uninstalled

2012-03-04 Thread Stephen Kelly
Brad King brad.king@... writes:

 That's a good start.  However I do not think the logic plays well
 with BUILD_WITH_INSTALL_RPATH as currently written.  If that is
 set then the build tree should end up with the install-tree rpath
 which should be empty if SKIP_INSTALL_RPATH is on.  Therefore
 the relink/chrpath paths should not need to return true always
 when SKIP_INSTALL_RPATH is on.
 

Sorry this took so long. I have updated the branch (It is now
e96c16ae23885be2e66d67291344369585ebfece)


--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Modifying RPATH feature to run tests uninstalled

2012-02-20 Thread Brad King

On 2/19/2012 6:38 PM, Stephen Kelly wrote:

I have also added a skip-install-rpath branch to my clone for review.

So far it's a quick hack. I'm not sure if I'm barking up the right or wrong
tree.


That's a good start.  However I do not think the logic plays well
with BUILD_WITH_INSTALL_RPATH as currently written.  If that is
set then the build tree should end up with the install-tree rpath
which should be empty if SKIP_INSTALL_RPATH is on.  Therefore
the relink/chrpath paths should not need to return true always
when SKIP_INSTALL_RPATH is on.

-Brad
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Modifying RPATH feature to run tests uninstalled

2012-02-20 Thread Stephen Kelly
Brad King wrote:

 On 2/19/2012 6:38 PM, Stephen Kelly wrote:
 I have also added a skip-install-rpath branch to my clone for review.

 So far it's a quick hack. I'm not sure if I'm barking up the right or
 wrong tree.
 
 That's a good start.  However I do not think the logic plays well
 with BUILD_WITH_INSTALL_RPATH as currently written.  If that is
 set then the build tree should end up with the install-tree rpath
 which should be empty if SKIP_INSTALL_RPATH is on.  Therefore
 the relink/chrpath paths should not need to return true always
 when SKIP_INSTALL_RPATH is on.
 

Right. I'll do some more testing this week hopefully at some point.

Thanks,

Steve.

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Modifying RPATH feature to run tests uninstalled

2012-02-19 Thread Stephen Kelly
Brad King wrote:

 On 2/17/2012 9:13 AM, Stephen Kelly wrote:
 If CMAKE_SKIP_INSTALL_RPATH is used by our buildsystems and
 CMAKE_SKIP_RPATH is not, distros will learn that they can run unit tests
 if they build their packages with the former instead of the latter.

  From my point of view though, the ENVIRONMENT property manipulation
  solves
 enough of the problem already. It makes 'make test' work.

 What it doesn't fix is running a unit test executable directly without
 setting the environment manually or running make install. I don't see why
 that should be expected to work though if the developer disables the
 RPATH stuff. It also doesn't work currently (without wrapper scripts), so
 nothing is really lost.

 However, adding CMAKE_SKIP_INSTALL_RPATH would make that work even if a
 developer wanted to disable RPATH, so maybe it's a nice thing to do.
 
 This is achievable by project code if it never sets INSTALL_RPATH.
 However it can be convenient for distros to have a hammer like
 CMAKE_SKIP_INSTALL_RPATH to avoid patching uncooperative projects.
 
 Distros are using CMAKE_SKIP_RPATH as that hammer now, and it's a
 pain for tests.  I think CMAKE_SKIP_INSTALL_RPATH is the right
 balance.  It allows tests to run and distros to avoid RPATH in
 their packages.

I have also added a skip-install-rpath branch to my clone for review.

So far it's a quick hack. I'm not sure if I'm barking up the right or wrong 
tree.

Thanks,

Steve.


--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Modifying RPATH feature to run tests uninstalled

2012-02-17 Thread Stephen Kelly
Marcel Loose wrote:

 Hi,
 
 On Fri, 2012-02-17 at 08:51 +0100, Alexander Neundorf wrote:
 
 -- 8  8  8  8  8  8  8  8  8 --
 
  So the suggestion is
  
  a) Change CMAKE_SKIP_RPATH to only skip RPATH when installing, but
 not when
  building (I don't know if that's easy in CMake), or alternatively
 provide
  another CMAKE_ variable to do that.
  
  b) Implement something like:
  set_property(TARGET foo APPEND PROPERTY TEST_ENVIRONMENT foo=bar)
  
  
  Possibly both a) and b).
  
  Thoughts/comments?
 
 b) is IMO definitely a missing feature.
 (but even with that, we (KDE) would have to keep a macro, because we
 can't
 expect that all developers know how to set this properly for all
 platforms.
 ...or, since it is a target property, this could be also intialized
 from a
 CMAKE_TEST_ENVIRONMENT cmake variable).
 
 Maybe I'm missing the point but there is a property ENVIRONMENT for
 tests:
 http://cmake.org/cmake/help/cmake-2-8-docs.html#prop_test:ENVIRONMENT

That indeed looks like what was discussed in one of the links I posted.

However I tried it out and it didn't work for me (with CMAKE_SKIP_RPATH):
 
stephen@hal:~/dev/build/qt/grantlee$ LD_LIBRARY_PATH=$PWD/templates/lib 
./templates/tests/testsafestring_exec 
* Start testing of TestSafeString *
Config: Using QTest library 4.7.4, Qt 4.7.4
PASS   : TestSafeString::initTestCase()
PASS   : TestSafeString::testCombining()
PASS   : TestSafeString::testAppending()
PASS   : TestSafeString::testChopping()
PASS   : TestSafeString::testReplacing()
PASS   : TestSafeString::cleanupTestCase()
Totals: 6 passed, 0 failed, 0 skipped
* Finished testing of TestSafeString *
Qt( ) KDE ( ) 
stephen@hal:~/dev/build/qt/grantlee$ ctest -V .
UpdateCTestConfiguration  from 
:/home/stephen/dev/build/qt/grantlee/DartConfiguration.tcl
Parse Config file:/home/stephen/dev/build/qt/grantlee/DartConfiguration.tcl
UpdateCTestConfiguration  from 
:/home/stephen/dev/build/qt/grantlee/DartConfiguration.tcl
Parse Config file:/home/stephen/dev/build/qt/grantlee/DartConfiguration.tcl
Test project /home/stephen/dev/build/qt/grantlee
Constructing a list of tests
Done constructing a list of tests
Checking test dependency graph...
Checking test dependency graph end
test 1
  Start  1: testsafestring

1: Test command: 
/home/stephen/dev/build/qt/grantlee/templates/tests/testsafestring_exec
1: Test timeout computed to be: 1500
1: /home/stephen/dev/build/qt/grantlee/templates/tests/testsafestring_exec: 
error while loading shared libraries: libgrantlee_core.so.0: cannot open 
shared object file: No such file or directory
 1/11 Test  #1: testsafestring ...***Failed0.00 sec
Qt( ) KDE ( ) 
stephen@hal:~/dev/src/grantlee{master}$ git diff 
diff --git a/templates/tests/CMakeLists.txt b/templates/tests/CMakeLists.txt
index d2e37d2..ad471c7 100644
--- a/templates/tests/CMakeLists.txt
+++ b/templates/tests/CMakeLists.txt
@@ -83,6 +83,7 @@ macro(GRANTLEE_TEMPLATES_UNIT_TESTS)
   ${_testresource_rcc_src}
 )
 add_test(${_testname} ${_testname}_exec )
+set_property(TEST ${testname} PROPERTY ENVIRONMENT 
LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/templates/lib)


Do you see anything wrong there?

Thanks,

Steve.



--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Modifying RPATH feature to run tests uninstalled

2012-02-17 Thread Marcel Loose
Hi Stephen,

On Fri, 2012-02-17 at 12:06 +0100, Stephen Kelly wrote:

-- 8  8  8  8  8  8  8  8  8 --

 diff --git a/templates/tests/CMakeLists.txt
b/templates/tests/CMakeLists.txt
 index d2e37d2..ad471c7 100644
 --- a/templates/tests/CMakeLists.txt
 +++ b/templates/tests/CMakeLists.txt
 @@ -83,6 +83,7 @@ macro(GRANTLEE_TEMPLATES_UNIT_TESTS)
${_testresource_rcc_src}
  )
  add_test(${_testname} ${_testname}_exec )
 +set_property(TEST ${testname} PROPERTY ENVIRONMENT 
 LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/templates/lib)
 
 
 Do you see anything wrong there?

You should use ${_testname} in the set_property() command. Don't you get
an error message from CMake? Or do you happen to have a variable
testname as well.

 
 Thanks,
 
 Steve.

Cheers,
Marcel.


--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Modifying RPATH feature to run tests uninstalled

2012-02-17 Thread Stephen Kelly
Marcel Loose wrote:

 Hi Stephen,
 
 On Fri, 2012-02-17 at 12:06 +0100, Stephen Kelly wrote:
 
 -- 8  8  8  8  8  8  8  8  8 --
 
 diff --git a/templates/tests/CMakeLists.txt
 b/templates/tests/CMakeLists.txt
 index d2e37d2..ad471c7 100644
 --- a/templates/tests/CMakeLists.txt
 +++ b/templates/tests/CMakeLists.txt
 @@ -83,6 +83,7 @@ macro(GRANTLEE_TEMPLATES_UNIT_TESTS)
${_testresource_rcc_src}
  )
  add_test(${_testname} ${_testname}_exec )
 +set_property(TEST ${testname} PROPERTY ENVIRONMENT
 LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/templates/lib)
 
 
 Do you see anything wrong there?
 
 You should use ${_testname} in the set_property() command. Don't you get
 an error message from CMake? Or do you happen to have a variable
 testname as well.
 

D'Oh! You're right. I typo'd there. It works with my system Qt if I fix the 
typo.

However, it doesn't solve the whole problem for me. Mostly I use a Qt in a 
non-standard prefix and I set LD_LIBRARY_PATH to find it (I have many Qts 
and a script to change my environment)

I tried changing it to 
set_property(TEST ${_testname} PROPERTY ENVIRONMENT 
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${CMAKE_BINARY_DIR}/templates/lib)

ie appending to the LD_LIBRARY_PATH, and it didn't find the correct Qt. It 
found my system Qt (4.7) instead of my environment Qt (4.8) which has new 
methods and so I get symbol lookup errors.

Is that something relevant for others that we should care about? Or is my 
setup unusual and irrelevant? Is it a bug that the LD_LIBRARY_PATH from my 
environment is not carried over?

Thanks,

Steve.

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Modifying RPATH feature to run tests uninstalled

2012-02-17 Thread Eric Noulard
2012/2/17 Stephen Kelly steve...@gmail.com:
 Marcel Loose wrote:

 Hi Stephen,

 On Fri, 2012-02-17 at 12:06 +0100, Stephen Kelly wrote:

 -- 8  8  8  8  8  8  8  8  8 --

 diff --git a/templates/tests/CMakeLists.txt
 b/templates/tests/CMakeLists.txt
 index d2e37d2..ad471c7 100644
 --- a/templates/tests/CMakeLists.txt
 +++ b/templates/tests/CMakeLists.txt
 @@ -83,6 +83,7 @@ macro(GRANTLEE_TEMPLATES_UNIT_TESTS)
                    ${_testresource_rcc_src}
      )
      add_test(${_testname} ${_testname}_exec )
 +    set_property(TEST ${testname} PROPERTY ENVIRONMENT
 LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/templates/lib)


 Do you see anything wrong there?

 You should use ${_testname} in the set_property() command. Don't you get
 an error message from CMake? Or do you happen to have a variable
 testname as well.


 D'Oh! You're right. I typo'd there. It works with my system Qt if I fix the
 typo.

 However, it doesn't solve the whole problem for me. Mostly I use a Qt in a
 non-standard prefix and I set LD_LIBRARY_PATH to find it (I have many Qts
 and a script to change my environment)

 I tried changing it to
    set_property(TEST ${_testname} PROPERTY ENVIRONMENT
 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${CMAKE_BINARY_DIR}/templates/lib)

 ie appending to the LD_LIBRARY_PATH, and it didn't find the correct Qt.

I'm not sure it'll append using this shell-like syntax, which suppose
shell-like evaluation for $LD_LIBRARY_PATH.

Could you try
LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_BINARY_DIR}/templates/lib
instead, which uses the CMake variable syntax to access environment.

 Is that something relevant for others that we should care about? Or is my
 setup unusual and irrelevant? Is it a bug that the LD_LIBRARY_PATH from my
 environment is not carried over?

Does you initial environment export LD_LIBRARY_PATH or not (simple set) ?

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Modifying RPATH feature to run tests uninstalled

2012-02-17 Thread Stephen Kelly
Eric Noulard wrote:

 2012/2/17 Stephen Kelly
 steve...@gmail.com:
 Marcel Loose wrote:

 Hi Stephen,

 On Fri, 2012-02-17 at 12:06 +0100, Stephen Kelly wrote:

 -- 8  8  8  8  8  8  8  8  8 --

 diff --git a/templates/tests/CMakeLists.txt
 b/templates/tests/CMakeLists.txt
 index d2e37d2..ad471c7 100644
 --- a/templates/tests/CMakeLists.txt
 +++ b/templates/tests/CMakeLists.txt
 @@ -83,6 +83,7 @@ macro(GRANTLEE_TEMPLATES_UNIT_TESTS)
 ${_testresource_rcc_src}
 )
 add_test(${_testname} ${_testname}_exec )
 +set_property(TEST ${testname} PROPERTY ENVIRONMENT
 LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/templates/lib)


 Do you see anything wrong there?

 You should use ${_testname} in the set_property() command. Don't you get
 an error message from CMake? Or do you happen to have a variable
 testname as well.


 D'Oh! You're right. I typo'd there. It works with my system Qt if I fix
 the typo.

 However, it doesn't solve the whole problem for me. Mostly I use a Qt in
 a non-standard prefix and I set LD_LIBRARY_PATH to find it (I have many
 Qts and a script to change my environment)

 I tried changing it to
 set_property(TEST ${_testname} PROPERTY ENVIRONMENT
 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${CMAKE_BINARY_DIR}/templates/lib)

 ie appending to the LD_LIBRARY_PATH, and it didn't find the correct Qt.
 
 I'm not sure it'll append using this shell-like syntax, which suppose
 shell-like evaluation for $LD_LIBRARY_PATH.
 
 Could you try
 LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_BINARY_DIR}/templates/lib
 instead, which uses the CMake variable syntax to access environment.

Yes, that works fine as expected, thanks!

 
 Is that something relevant for others that we should care about? Or is my
 setup unusual and irrelevant? Is it a bug that the LD_LIBRARY_PATH from
 my environment is not carried over?
 
 Does you initial environment export LD_LIBRARY_PATH or not (simple set) ?
 

It is exported.

So that resolves one of the two issues I posted about. 

The other issue is regarding setting RPATH for the build step and not the 
install step, and what syntax should be used for that. 

The options are:

a) Change the behaviour of CMAKE_SKIP_RPATH to set the RPATH in the build
   dir (does this need a policy)

b) Add the new variable CMAKE_SKIP_INSTALL_RPATH to skip only the 
   installation RPATH, but do use it for the build step. (Fits with existing 
CMAKE_SKIP_BUILD_RPATH)

c) Make the existing CMAKE_SKIP_BUILD_RPATH override CMAKE_SKIP_RPATH if set 
   to false. (This probably would need a policy)

My choice is b), but I don't know if there are good reasons for the others.


--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Modifying RPATH feature to run tests uninstalled

2012-02-17 Thread Alexander Neundorf
On Friday 17 February 2012, Stephen Kelly wrote:
...
 The other issue is regarding setting RPATH for the build step and not the
 install step, and what syntax should be used for that.
 
 The options are:
 
 a) Change the behaviour of CMAKE_SKIP_RPATH to set the RPATH in the build
dir (does this need a policy)
 
 b) Add the new variable CMAKE_SKIP_INSTALL_RPATH to skip only the
installation RPATH, but do use it for the build step. (Fits with
 existing CMAKE_SKIP_BUILD_RPATH)
 
 c) Make the existing CMAKE_SKIP_BUILD_RPATH override CMAKE_SKIP_RPATH if
 set to false. (This probably would need a policy)
 
 My choice is b), but I don't know if there are good reasons for the others.

I'm not sure this would help a lot.
Some people (distro packagers) disable RPATH by setting CMAKE_SKIP_RPATH to 
TRUE.
CMAKE_SKIP_RPATH is the big switch which overrides all others. So if this is 
used, we would still have no RPATH in the build tree.

Alex
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Modifying RPATH feature to run tests uninstalled

2012-02-17 Thread Stephen Kelly
Alexander Neundorf wrote:

 On Friday 17 February 2012, Stephen Kelly wrote:
 ...
 The other issue is regarding setting RPATH for the build step and not the
 install step, and what syntax should be used for that.
 
 The options are:
 
 a) Change the behaviour of CMAKE_SKIP_RPATH to set the RPATH in the build
dir (does this need a policy)
 
 b) Add the new variable CMAKE_SKIP_INSTALL_RPATH to skip only the
installation RPATH, but do use it for the build step. (Fits with
 existing CMAKE_SKIP_BUILD_RPATH)
 
 c) Make the existing CMAKE_SKIP_BUILD_RPATH override CMAKE_SKIP_RPATH if
 set to false. (This probably would need a policy)
 
 My choice is b), but I don't know if there are good reasons for the
 others.
 
 I'm not sure this would help a lot.
 Some people (distro packagers) disable RPATH by setting CMAKE_SKIP_RPATH
 to TRUE.
 CMAKE_SKIP_RPATH is the big switch which overrides all others. So if this
 is used, we would still have no RPATH in the build tree.
 

Are you saying this is a chicken-egg problem?

If CMAKE_SKIP_INSTALL_RPATH is used by our buildsystems and CMAKE_SKIP_RPATH 
is not, distros will learn that they can run unit tests if they build their 
packages with the former instead of the latter.

From my point of view though, the ENVIRONMENT property manipulation solves 
enough of the problem already. It makes 'make test' work. 

What it doesn't fix is running a unit test executable directly without 
setting the environment manually or running make install. I don't see why 
that should be expected to work though if the developer disables the RPATH 
stuff. It also doesn't work currently (without wrapper scripts), so nothing 
is really lost.

However, adding CMAKE_SKIP_INSTALL_RPATH would make that work even if a 
developer wanted to disable RPATH, so maybe it's a nice thing to do.

Thanks,

Steve.


--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Modifying RPATH feature to run tests uninstalled

2012-02-17 Thread Alexander Neundorf
On Friday 17 February 2012, Stephen Kelly wrote:
 Alexander Neundorf wrote:
  On Friday 17 February 2012, Stephen Kelly wrote:
  ...
  
  The other issue is regarding setting RPATH for the build step and not
  the install step, and what syntax should be used for that.
  
  The options are:
  
  a) Change the behaviour of CMAKE_SKIP_RPATH to set the RPATH in the
  build
  
 dir (does this need a policy)
  
  b) Add the new variable CMAKE_SKIP_INSTALL_RPATH to skip only the
  
 installation RPATH, but do use it for the build step. (Fits with
  
  existing CMAKE_SKIP_BUILD_RPATH)
  
  c) Make the existing CMAKE_SKIP_BUILD_RPATH override CMAKE_SKIP_RPATH if
  set to false. (This probably would need a policy)
  
  My choice is b), but I don't know if there are good reasons for the
  others.
  
  I'm not sure this would help a lot.
  Some people (distro packagers) disable RPATH by setting CMAKE_SKIP_RPATH
  to TRUE.
  CMAKE_SKIP_RPATH is the big switch which overrides all others. So if this
  is used, we would still have no RPATH in the build tree.
 
 Are you saying this is a chicken-egg problem?
 
 If CMAKE_SKIP_INSTALL_RPATH is used by our buildsystems and
 CMAKE_SKIP_RPATH is not, distros will learn that they can run unit tests
 if they build their packages with the former instead of the latter.
 
 From my point of view though, the ENVIRONMENT property manipulation solves
 enough of the problem already. It makes 'make test' work.
 
 What it doesn't fix is running a unit test executable directly without
 setting the environment manually or running make install. I don't see why
 that should be expected to work though if the developer disables the RPATH
 stuff. It also doesn't work currently (without wrapper scripts), so nothing
 is really lost.
 
 However, adding CMAKE_SKIP_INSTALL_RPATH would make that work even if a
 developer wanted to disable RPATH, so maybe it's a nice thing to do.

Yes, but this could be done already right now.
We (KDE) could add an option(), which when enabled sets CMAKE_INSTALL_RPATH 
empty, and CMAKE_INSTALL_RPATH_USE_LINK_PATH to FALSE. This would be the same 
effect.

CMAKE_SKIP_RPATH is intentionally for people who just want to disable RPATH no 
matter what the project does.

...maybe we (KDE) could do:

if(CMAKE_SKIP_RPATH)
  set(CMAKE_SKIP_RPATH FALSE)
  set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
  set(CMAKE_INSTALL_RPATH )
endif()

... I didn't say that loud, did I ? ;-)

Alex
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


Re: [cmake-developers] Modifying RPATH feature to run tests uninstalled

2012-02-17 Thread Brad King

On 2/17/2012 9:31 AM, Alexander Neundorf wrote:

Yes, but this could be done already right now.
We (KDE) could add an option(), which when enabled sets CMAKE_INSTALL_RPATH
empty, and CMAKE_INSTALL_RPATH_USE_LINK_PATH to FALSE. This would be the same
effect.

CMAKE_SKIP_RPATH is intentionally for people who just want to disable RPATH no
matter what the project does.

...maybe we (KDE) could do:

if(CMAKE_SKIP_RPATH)
   set(CMAKE_SKIP_RPATH FALSE)
   set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
   set(CMAKE_INSTALL_RPATH )
endif()


As I said in parallel to your response I'd prefer that distros
use a hammer like CMAKE_SKIP_INSTALL_RPATH so they do not have
to depend on the project supporting it with code like the above.
I'd like to discourage them from using CMAKE_SKIP_RPATH because
it is a pain for testing.

Of course your approach doesn't depend on any new CMake changes
so you can use it right now to get started.

-Brad
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers


[cmake-developers] Modifying RPATH feature to run tests uninstalled

2012-02-16 Thread Stephen Kelly

Hi there,

One of the macros we have in KDE creates shell scripts to initialize 
environment variables needed on various platforms so that tests can be run 
before installation. If RPATH is enabled, the scripts are not needed, but 
RPATH is sometimes disabled, so the scripts are the solution to that.

With the modularization of kdelibs into KDE frameworks (multiple independent 
pieces), we wondered what to do with that macro and how we can retain its 
features easily after making kdelibs non-monolithic.

I chatted with debian packager Sune Vuorela this evening about this. The 
linked thread is long and contains long emails, so all of the context is in 
the IRC log.

steveire svuorela: ping?
steveire I'm wondering about debian packages.
steveire Is it normal to run tests before installing them?
steveire Grep for 'Sune' here: 
http://thread.gmane.org/gmane.comp.kde.devel.buildsystem/6961/focus=201
svuorela steveire: it depends on the package. we aren't running kdelibs 
tests, but we are running libc tests
steveire svuorela: And do you run them before installation?
svuorela steveire: I think so yes. but even if run after installation it 
is in a weird prefix (DESTDIR)
steveire By coincidence I got an email yesterday from bricks (who packages 
Grantlee) and he was asking about running tests before installation. He hit 
the issue in that thread for the exact reason that is there (ie debian 
disabled RPATH). Is that the 'normal' way to run tests in debian packaging 
systems?
svuorela steveire: so even if RPATH was set you coulddn't easily actually 
find the installed bits ...
steveire ... if the install location isn't already in LD_LIBRARY_PATH?
svuorela ...but as a normal user, I would expect that make intsall is 
something I run after a succsessfull make test
steveire svuorela: What do you think of Alex' suggestion? Or should 
CMAKE_SKIP_RPATH only disable the RPATH for the install tree ?
steveire Debian packagers still wouldn't allow the RPATH to be used in the 
binary dir, would they?
steveire So it still wouldn't be possbile to run them uninstalled?
svuorela at least from a debian pov, it is the installed version of things 
that matters. if  there is a intermediate RPATH at a stage during 
compilation no one would care.
svuorela and I actually think that it makes quite good sense to have RPATH 
on during compilation
steveire Right, which is why kde creates wrapper scripts to run unit tests 
with env vars set to find the libraries.
steveire It looks like this is the most likely solution: http://www.mail-
archive.com/cm...@cmake.org/msg12056.html What do you think?
steveire We could add LD_LIBRARY_PATH/DYLD_LIBRARY_PATH/PATH in a command 
like that.
svuorela steveire: I think it makes good sense both to have RPATHs in the 
build tree (and strip them on install if -DCMAKE_SKIP_RPATH) and to have a 
way of setting env vars for make test
steveire svuorela: Ok, do you mind if I post some of this discussion to 
the cmake-developers list?
svuorela steveire: feel free.


So the suggestion is

a) Change CMAKE_SKIP_RPATH to only skip RPATH when installing, but not when 
building (I don't know if that's easy in CMake), or alternatively provide 
another CMAKE_ variable to do that.

b) Implement something like:
set_property(TARGET foo APPEND PROPERTY TEST_ENVIRONMENT foo=bar)


Possibly both a) and b).

Thoughts/comments?

Thanks,

Steve.



--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers