Re: [CMake] Modern CMake + CUDA + Clang

2018-03-11 Thread Stephen McDowell
I found the GitLab tracker: https://gitlab.kitware.com/cmake/cmake/issues/16586 



-- 

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


[CMake] Swift Makefile/Ninja generator: trying to bring up to date

2018-03-11 Thread Eric Wing
Hi, I know it’s been awhile since I last posted anything about this.
Since my last post, I had quietly added to the Ninja backend to bring
it to par with the initial work I did on the Makefile generator. This
was partly done because I was trying to get compatibility with Android
which uses the CMake/Ninja generator.

Anyway, the CMake/Android support has come a long way in the past
year. I see that there is now even a way to specify an external CMake
in local.properties as long as it is 3.7 (or greater I presume).

I really need to be leveraging all the new support in Android Studio,
so I need to update my version of CMake. Unfortunately, my Swift work
started before 3.7, and I just tried a merge with the latest, but the
merge went very badly. It looks like cmLocalGenerator.cxx has been
significantly rewritten in passing time, and I am no longer certain
how to integrate my original changes.

Can some of you CMake guru’s clue me in on how I should change my
original patch to now work with the current CMake source? Is
cmLocalGenerator.cxx my only problem, or are there other architectural
changes I need to be aware of to make all the other changes in other
files also work?


There are 10 small commits I made in a separate branch for my original
change, which can be seen at the top of the page at GitHub:
https://github.com/ewmailing/CMake/commits/SwiftMakefile

Thanks,
Eric
-- 

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


[Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-194-gb340cac

2018-03-11 Thread Kitware Robot
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
   via  b340cacde869102b2b548b2e7ebc7341334f1d58 (commit)
  from  c703972694874acc0c9921dcb1190700d98eb3c2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b340cacde869102b2b548b2e7ebc7341334f1d58
commit b340cacde869102b2b548b2e7ebc7341334f1d58
Author: Kitware Robot <kwro...@kitware.com>
AuthorDate: Mon Mar 12 00:01:06 2018 -0400
Commit: Kitware Robot <kwro...@kitware.com>
CommitDate: Mon Mar 12 00:01:06 2018 -0400

CMake Nightly Date Stamp

diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 2984ced..a9bf8e6 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
 # CMake version number components.
 set(CMake_VERSION_MAJOR 3)
 set(CMake_VERSION_MINOR 11)
-set(CMake_VERSION_PATCH 20180311)
+set(CMake_VERSION_PATCH 20180312)
 #set(CMake_VERSION_RC 1)

---

Summary of changes:
 Source/CMakeVersion.cmake |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


hooks/post-receive
-- 
CMake
___
Cmake-commits mailing list
Cmake-commits@cmake.org
https://cmake.org/mailman/listinfo/cmake-commits


[CMake] Modern CMake + CUDA + Clang

2018-03-11 Thread Stephen McDowell
Hello!

I stumbled across the new 3.8+ CUDA as a language capabilities, and am very 
excited about this!

1. Does anybody know when CMAKE_CUDA_COMPILER_ID and 
CMAKE_CUDA_COMPILER_VERSION were fixed?

With cmake 3.9.4 some of the cuda compiler variables were unset:

   message("CXX compiler stuff:")
   message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
   message(STATUS "CMAKE_CXX_COMPILER_ID:  ${CMAKE_CXX_COMPILER_ID}")
   message(STATUS "CMAKE_CXX_COMPILER_VERSION: ${CMAKE_CXX_COMPILER_VERSION}")
   message("CUDA compiler stuff:")
   message(STATUS "CMAKE_CUDA_COMPILER: ${CMAKE_CUDA_COMPILER}")
   message(STATUS "CMAKE_CUDA_COMPILER_ID:  ${CMAKE_CUDA_COMPILER_ID}")
   message(STATUS "CMAKE_CUDA_COMPILER_VERSION: ${CMAKE_CUDA_COMPILER_VERSION}")
   message(FATAL_ERROR "bye bye")

CMAKE_CUDA_COMPILER was set, but COMPILER_ID and COMPILER_VERSION were not.  I 
just updated to 3.10.2 and they were giving values I would expect.  I dug 
around under the diffs on Modules but got really turned around.

I would like to set my minimum required version to whenever this was 
introduced, as I would like to wield it.

2. Is there any existing work / discussion on the new world order (CUDA as a 
full-fledged language) and Clang?  I noticed that the following happens:

   if(CMAKE_CUDA_COMPILER_ID)
 include(Compiler/${CMAKE_CUDA_COMPILER_ID}-CUDA OPTIONAL)
   endif()

leaving room for a Compiler/Clang-CUDA.cmake to be created.  Is there an 
eventual goal to write this?  I think I can maybe help get a prototype working 
if that was the goal for this setup.

3. Supposing CMake + Clang + CUDA was working, the working assumption would be 
that a user sets CUDACXX to clang++, right?  I’m trying to understand if Clang 
as a cuda compiler already works and I have bad local configurations, or if 
they are needing to be written.

Thanks for any thoughts!

-Stephen

-- 

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] How to link against projects added through FetchContent

2018-03-11 Thread Saad Khattak
Thank you for the clarifications Craig! The confusion mainly stemmed from
${Catch2_SOURCE_DIR} where 'Catch2' should have been lowercase. I had
originally started with the name 'catch' (which would explain why I
accidentally left it unchanged in the _GetProperties function) but when
that didn't work, I started assuming that perhaps it was conflicting with
the actual library. It was all downhill from there :)

After your suggestions, I was successfully able to get it to work. For
future reference for anyone stumbling on this answer, here's a minimum
example of a working version:
https://github.com/samaursa/cmake_fetch_content

>> I'm a little surprised CMake didn't complain about that, it does for me
when I tested this just now

CMake did not warn me about it. I am on CMake Version 3.11.0-rc3. It would
be great if this warning could be emphasized by CMake as without it, it is
difficult to tell what went wrong since `target_link_libraries` also fails
and I simply get compile errors for missing headers.

On Sun, Mar 11, 2018 at 8:55 PM Craig Scott  wrote:

> Thanks for trying out the new FetchContent module. Comments on your
> question interspersed below.
>
>
> On Mon, Mar 12, 2018 at 11:02 AM, Saad Khattak 
> wrote:
>
>> Hi,
>>
>> I would like to know how to use the FetchContent properly so that I can
>> link against downloaded (CMake enabled) projects. I have looked at the
>> CMake docs, which although are quite thorough, almost always fail to list a
>> complete example which is incredibly crucial to get up and running quickly.
>>
>> With ExternalProject_Add, we use add_dependencies(...) but that doesn't
>> seem to be the case for FetchContent. Since I can immediately call
>> add_subdirectory(...), I assumed that I can simply link to the library. But
>> that doesn't seem to do anything.
>>
>
> This is indeed how it should work. After you've called add_subdirectory(),
> the targets defined by the project being added should be immediately
> available just like any other target your own project would define.
>
>
>
>>
>> Here's my CMakeLists.txt
>> ``
>> cmake_minimum_required(VERSION 3.5)
>>
>
> Your minimum CMake version will be 3.11 if you want to use FetchContent,
> so consider specifying that as the minimum version here.
>
>
>
>
>> project(testProj)
>>
>> include(FetchContent)
>>
>> FetchContent_Declare(
>>   Catch2
>>   GIT_REPOSITORY "https://github.com/catchorg/Catch2;
>>   TEST_COMMAND ""
>>   )
>>
>
> As stated in the docs, TEST_COMMAND will be ignored, so don't set it here.
> FetchContent only downloads, it doesn't build (you're in control of that,
> see further comments below). The ExternalProject_Add() docs also recommend
> you set GIT_TAG to the specific git hash you want to use (apart from being
> more robust, it saves having to contact the remote each time CMake is run
> after it has been cloned). FetchContent delegates all downloading to
> ExternalProject, so the comments apply here as well.
>
>
>
>>
>> FetchContent_GetProperties(catch)
>>
>
> This needs to be the same as the first argument to FetchContent_Declare()
> above, i.e. Catch2
>
>
>> if(NOT Catch2_POPULATED)
>>   FetchContent_Populate(Catch2)
>>   add_subdirectory(${Catch2_SOURCE_DIR} ${Catch2_BINARY_DIR})
>>
>
> The documentation for the FetchContent_Populate() function state that the
> variable names use lowercased names of the content name (i.e.
> catch2_SOURCE_DIR rather than Catch2_SOURCE_DIR), so both of these
> variables used here will be empty. I'm a little surprised CMake didn't
> complain about that, it does for me when I tested this just now. Same for
> the variable name used in the if test (i.e. use catch2_POPULATED rather
> than Catch2_POPULATED).
>
> The reason for the lowercasing is that it was found during the 2 years or
> so when we were dog-fooding this module that while people usually got the
> name right, there would be variations in upper/lowercase which made things
> less reliable.
>
>
>
>> endif()
>>
>> add_executable(testExe main.cpp)
>>
>> target_link_libraries(testExe Catch2)
>>
>
> If the Catch2 project defines a library called Catch2, then this line
> should work fine once you fix the above problems. I think you want Catch
> rather than Catch2 though.
>
>
>
>
>> ``
>>
>> CMake populates Catch2 with Catch2-NOTFOUND.
>>
>> So, my question is, how do I link against projects added through
>> FetchContent?
>>
>
>
>
>
>
> --
> Craig Scott
> Melbourne, Australia
> https://crascit.com
>
-- 

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html

Re: [CMake] How to link against projects added through FetchContent

2018-03-11 Thread Craig Scott
Thanks for trying out the new FetchContent module. Comments on your
question interspersed below.


On Mon, Mar 12, 2018 at 11:02 AM, Saad Khattak  wrote:

> Hi,
>
> I would like to know how to use the FetchContent properly so that I can
> link against downloaded (CMake enabled) projects. I have looked at the
> CMake docs, which although are quite thorough, almost always fail to list a
> complete example which is incredibly crucial to get up and running quickly.
>
> With ExternalProject_Add, we use add_dependencies(...) but that doesn't
> seem to be the case for FetchContent. Since I can immediately call
> add_subdirectory(...), I assumed that I can simply link to the library. But
> that doesn't seem to do anything.
>

This is indeed how it should work. After you've called add_subdirectory(),
the targets defined by the project being added should be immediately
available just like any other target your own project would define.



>
> Here's my CMakeLists.txt
> ``
> cmake_minimum_required(VERSION 3.5)
>

Your minimum CMake version will be 3.11 if you want to use FetchContent, so
consider specifying that as the minimum version here.




> project(testProj)
>
> include(FetchContent)
>
> FetchContent_Declare(
>   Catch2
>   GIT_REPOSITORY "https://github.com/catchorg/Catch2;
>   TEST_COMMAND ""
>   )
>

As stated in the docs, TEST_COMMAND will be ignored, so don't set it here.
FetchContent only downloads, it doesn't build (you're in control of that,
see further comments below). The ExternalProject_Add() docs also recommend
you set GIT_TAG to the specific git hash you want to use (apart from being
more robust, it saves having to contact the remote each time CMake is run
after it has been cloned). FetchContent delegates all downloading to
ExternalProject, so the comments apply here as well.



>
> FetchContent_GetProperties(catch)
>

This needs to be the same as the first argument to FetchContent_Declare()
above, i.e. Catch2


> if(NOT Catch2_POPULATED)
>   FetchContent_Populate(Catch2)
>   add_subdirectory(${Catch2_SOURCE_DIR} ${Catch2_BINARY_DIR})
>

The documentation for the FetchContent_Populate() function state that the
variable names use lowercased names of the content name (i.e.
catch2_SOURCE_DIR rather than Catch2_SOURCE_DIR), so both of these
variables used here will be empty. I'm a little surprised CMake didn't
complain about that, it does for me when I tested this just now. Same for
the variable name used in the if test (i.e. use catch2_POPULATED rather
than Catch2_POPULATED).

The reason for the lowercasing is that it was found during the 2 years or
so when we were dog-fooding this module that while people usually got the
name right, there would be variations in upper/lowercase which made things
less reliable.



> endif()
>
> add_executable(testExe main.cpp)
>
> target_link_libraries(testExe Catch2)
>

If the Catch2 project defines a library called Catch2, then this line
should work fine once you fix the above problems. I think you want Catch
rather than Catch2 though.




> ``
>
> CMake populates Catch2 with Catch2-NOTFOUND.
>
> So, my question is, how do I link against projects added through
> FetchContent?
>





-- 
Craig Scott
Melbourne, Australia
https://crascit.com
-- 

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] How to link against projects added through FetchContent

2018-03-11 Thread Saad Khattak
I managed to find a solution myself:

``
cmake_minimum_required(VERSION 3.11)

project(testProj)

include(FetchContent)

FetchContent_Declare(
  Catch2
  GIT_REPOSITORY "https://github.com/catchorg/Catch2;
  )

FetchContent_GetProperties(Catch2) #mispelled name in original post
if(NOT Catch2_POPULATED)
  FetchContent_Populate(Catch2)
  message(STATUS "Catch source dir: ${catch2_SOURCE_DIR}")
  message(STATUS "Catch binary dir: ${catch2_BINARY_DIR}")
  add_subdirectory(${catch2_SOURCE_DIR} ${catch2_BINARY_DIR}) #can be case
insensitive
endif()

add_executable(testExe
  main.cpp
  )

message(STATUS "Catch include dir: ${catch2_SOURCE_DIR}/include")

target_link_libraries(testExe Catch) #name of library to link is case
sensitive!
``

On Sun, Mar 11, 2018 at 8:02 PM Saad Khattak  wrote:

> Hi,
>
> I would like to know how to use the FetchContent properly so that I can
> link against downloaded (CMake enabled) projects. I have looked at the
> CMake docs, which although are quite thorough, almost always fail to list a
> complete example which is incredibly crucial to get up and running quickly.
>
> With ExternalProject_Add, we use add_dependencies(...) but that doesn't
> seem to be the case for FetchContent. Since I can immediately call
> add_subdirectory(...), I assumed that I can simply link to the library. But
> that doesn't seem to do anything.
>
> Here's my CMakeLists.txt
> ``
> cmake_minimum_required(VERSION 3.5)
> project(testProj)
>
> include(FetchContent)
>
> FetchContent_Declare(
>   Catch2
>   GIT_REPOSITORY "https://github.com/catchorg/Catch2;
>   TEST_COMMAND ""
>   )
>
> FetchContent_GetProperties(catch)
> if(NOT Catch2_POPULATED)
>   FetchContent_Populate(Catch2)
>   add_subdirectory(${Catch2_SOURCE_DIR} ${Catch2_BINARY_DIR})
> endif()
>
> add_executable(testExe main.cpp)
>
> target_link_libraries(testExe Catch2)
> ``
>
> CMake populates Catch2 with Catch2-NOTFOUND.
>
> So, my question is, how do I link against projects added through
> FetchContent?
>
> - Saad
>
-- 

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] What are the actual benefits of namespaced targets?

2018-03-11 Thread Alan W. Irwin

On 2018-03-11 10:15+0100 Nils Gladitz wrote:


On 10.03.2018 23:01, Alan W. Irwin wrote:

Anyhow, your thoughts would be appreciated for reasonable best
practice limits on how far (if any) beyond the common code case you
would go to convert an old project to use
ALIAS libraries and modules in the build tree that have to be
implemented in any case for CMake code that is common to
both the build tree and install tree. 



Hello Alan,

I agree with your assessments.

Assuming a project that is highly structured through directory scopes I might 
consider the following.


Any target is defined in exactly one directory scope.
Any command that extends the definition of a target has to use the original 
target name and should be in the same directory scope.


In all other directory scopes I'd consider consistent use of a target's 
alias.


Hi Nils:

I think your suggestions prior to the last one above make perfect
sense, and as far as I know my three projects already conform to them.

But I have now considered your last suggestion (replacing read-only
library and module targets in the build tree with the relevant
namespaced target alias), but I have decided the cost/benefit ratio is
too high in the PLplot case.  The cost issue is PLplot has some 330
different build system files (those named "CMakeLists.txt", "*.cmake",
or "*in") and something like 30 different library and module targets.
An additional complication is all libraries include "plplot" in the
target name (including our principal library whose target name is
"plplot") but "plplot" also occurs in all sorts of other contexts in
those 330 files.  So making this change in the PLplot case would
require a massive mentally concentrated editing exercise for what I
think is a rather small and mostly stylistic benefit.  So for PLplot I
plan to limit use of namespaced targets to just the
target_link_libraries and add_dependencies commands that are common to
the build-tree and install-tree build systems.

In contrast to the PLplot case, the costs of your last suggestion are
much lower for the ephcom and te_gen cases (many fewer build-system
files, libraries, and modules) so in those cases I might go all the
way with converting the present read-only library and module targets
with namespaced targets.  And similarly when implementing new projects
since the costs are even lower in those cases.

Alan
__
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__

Linux-powered Science
__
--

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


[CMake] How to link against projects added through FetchContent

2018-03-11 Thread Saad Khattak
Hi,

I would like to know how to use the FetchContent properly so that I can
link against downloaded (CMake enabled) projects. I have looked at the
CMake docs, which although are quite thorough, almost always fail to list a
complete example which is incredibly crucial to get up and running quickly.

With ExternalProject_Add, we use add_dependencies(...) but that doesn't
seem to be the case for FetchContent. Since I can immediately call
add_subdirectory(...), I assumed that I can simply link to the library. But
that doesn't seem to do anything.

Here's my CMakeLists.txt
``
cmake_minimum_required(VERSION 3.5)
project(testProj)

include(FetchContent)

FetchContent_Declare(
  Catch2
  GIT_REPOSITORY "https://github.com/catchorg/Catch2;
  TEST_COMMAND ""
  )

FetchContent_GetProperties(catch)
if(NOT Catch2_POPULATED)
  FetchContent_Populate(Catch2)
  add_subdirectory(${Catch2_SOURCE_DIR} ${Catch2_BINARY_DIR})
endif()

add_executable(testExe main.cpp)

target_link_libraries(testExe Catch2)
``

CMake populates Catch2 with Catch2-NOTFOUND.

So, my question is, how do I link against projects added through
FetchContent?

- Saad
-- 

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] FindMPI & policy CMP0004

2018-03-11 Thread Craig Scott
This could be a case of needing to clear out an old CMake cache. That
problem you mentioned was supposed to have been fixed already. You can find
the updated discussion of the Mantis issue you linked to in gitlab here
 where someone else
had a situation that sounds similar to yours.


On Mon, Mar 12, 2018 at 7:16 AM, Andreas Naumann 
wrote:

> Dear all,
>
> recently, I got a problem with FindMPI on our HPC systems. With cmake
> 3.10.2, I get an error about policy CMP0004. And I cannot set it to OLD
> anymore. Is this intended?
>
> Exactly the same error, together with a patch, is described in the
> bugtracker https://public.kitware.com/Bug/view.php?id=11881
>
> I cannot reproduce the error easiliy. On my home system, it works. But on
> the hpc system, mpicc -showme:link returns
> -L/lib -lmpi -ldl -lm -lnuma -Wl,--export-dynamic -lrt -lnsl
> -lutil -lm -ldl
>
> so, we have exactly one -Wl, part and libraries otherwise. It
> looks to me, that the patch from the bugtracker should avoid the problem.
> Can somebody confirm this finding?
>
> The problem gets even worse with newercmake versions. With cmake 3.9, I
> can set policy cmp0004 to OLD, so FindMPI remains usable. With newer cmake
> versions, ie. 3.10.2,  the policy setting seems to get deprecated. So, the
> user won't get any way to use newer cmake with such a bug.
>
> What is the preferred way to resolve such an issue, when the policy
> setting is not allowed anymore?
>
> Regards,
> Andreas
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensou
> rce/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>



-- 
Craig Scott
Melbourne, Australia
https://crascit.com
-- 

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


[CMake] FindMPI & policy CMP0004

2018-03-11 Thread Andreas Naumann

Dear all,

recently, I got a problem with FindMPI on our HPC systems. With cmake 
3.10.2, I get an error about policy CMP0004. And I cannot set it to OLD 
anymore. Is this intended?


Exactly the same error, together with a patch, is described in the 
bugtracker https://public.kitware.com/Bug/view.php?id=11881


I cannot reproduce the error easiliy. On my home system, it works. But 
on the hpc system, mpicc -showme:link returns
-L/lib -lmpi -ldl -lm -lnuma -Wl,--export-dynamic -lrt -lnsl 
-lutil -lm -ldl


so, we have exactly one -Wl, part and libraries otherwise. It 
looks to me, that the patch from the bugtracker should avoid the problem.

Can somebody confirm this finding?

The problem gets even worse with newercmake versions. With cmake 3.9, I 
can set policy cmp0004 to OLD, so FindMPI remains usable. With newer 
cmake versions, ie. 3.10.2,  the policy setting seems to get deprecated. 
So, the user won't get any way to use newer cmake with such a bug.


What is the preferred way to resolve such an issue, when the policy 
setting is not allowed anymore?


Regards,
Andreas
--

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Adding a reference to Windows Media Player library using CMake + CSharp support

2018-03-11 Thread Cyril Boucher
Hi all,

I figured I would dig up this question as I found a decent solution to this
issue.

After having a look at how Microsoft Visual Studio is doing to include
references to external libraries, I came to realise that it is using a tool
called TlbImp, which is short for Type Library Importer.

The solution is pretty simple from there: use TlbImp to generate a library
that CSharp will be able to import and add it via CMake to the project. My
code for Windows Media Player boils down to this:

set(_outLib ${CMAKE_CURRENT_BINARY_DIR}/generated/Interop.WMPLib.dll)
execute_process(COMMAND ${TLBIMP_EXECUTABLE} ${WMP_LIBRARY}
/namespace:WMPLib /out:${_outLib}
RESULT_VARIABLE tlbimp_result
ERROR_FILE ${CMAKE_CURRENT_BINARY_DIR}/tlbimp_log.txt
)

set_target_properties(myproject
VS_DOTNET_REFERENCES "WMPLib"
VS_DOTNET_REFERENCEPROP_WMPLib_TAG_HintPath "${_outLib}"
)

And there you have it!

If you would like to see it used in a project, I have just uploaded a small
project to my github that uses just that: https://github.com/
cyrilBoucher/space-invaders

Hope this helps!
Cyril Boucher

2018-02-01 21:57 GMT+01:00 Cyril Boucher :

> Hi all,
>
> I am trying to use CMake and the CSharp support for a small project of
> mine but I cannot seem to find a way to add a reference to the Windows
> Media Player library. One of the reason for that is that I need to link my
> project to wmp.dll which then needs to generate Interop.WMPLib.dll and a
> reference needs to be added with its path pointing to the latter library.
>
> Adding wmp.dll to my project is as simple as a target_link_libraries call
> but this does not seem to trigger the whole generation and add reference
> sort of process.
>
> Has anyone ever had an experience with adding such libraries? Is there
> support for these scenarios?
>
> Thanks!
> Cyril Boucher
>
-- 

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] What are the actual benefits of namespaced targets?

2018-03-11 Thread Nils Gladitz

On 10.03.2018 23:01, Alan W. Irwin wrote:

Anyhow, your thoughts would be appreciated for reasonable best
practice limits on how far (if any) beyond the common code case you
would go to convert an old project to use
ALIAS libraries and modules in the build tree that have to be
implemented in any case for CMake code that is common to
both the build tree and install tree. 



Hello Alan,

I agree with your assessments.

Assuming a project that is highly structured through directory scopes I 
might consider the following.


Any target is defined in exactly one directory scope.
Any command that extends the definition of a target has to use the 
original target name and should be in the same directory scope.


In all other directory scopes I'd consider consistent use of a target's 
alias.


While it is less likely for a seasoned developer to trip over the 
interpretation ambiguity in link libraries (due to familiarity and the 
fact that they probably already tripped over this and know the symptoms) 
it might still be beneficial for new / casual contributors which as 
likely consumers might also already be familiar with the aliases.


One minor additional benefit might be that you are also not allowed to 
modify the original target through an alias.
As such this would prevent you (assuming you stick to the namespaced 
names) from modifying targets from within foreign scopes which I think 
is a good thing to enforce.


Beyond that consumers might be looking at your code base for examples on 
how to use the libraries in their own code where consistency might be 
beneficial.
It might also help (slightly) if you ever decided to split off parts of 
your project into new projects (which then would become consumers of the 
exported targets).


Nils
--

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake