[CMake] MSVC Version Location for VisualStudio Install

2019-11-12 Thread J. Caleb Wherry
All,

I have been adding support for VS2019 to our build and ran into some CMake
code that was hard coded for a specific version related to MSVC.
Specifically, it is the folder under the VS install dir with version like
"14.23.28105". It is in the path for where the compiler is found but I
can't find an actual variable that contains this version, is there one? I
need access to this folder because we ship the vc_redist and MergeModules
and need to install those. Since they are different between VS2017 and
VS2019 (and we have support for building in multiple VS versions at a
time), I need a way to get this version. I know I can parse it but was
hoping it was exposed some other way... FWIW: I already get the path to VS
version to use as a generator with vswhere so I am open to using that as
well if need be.

Here is the output of CMake with the version bolded for what I am referring
to.

---
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.
-- The C compiler identification is MSVC 19.23.28106.4
-- The CXX compiler identification is MSVC 19.23.28106.4
-- The ASM compiler identification is MSVC
-- Found assembler: C:/Program Files (x86)/Microsoft Visual
Studio/2019/Professional/VC/Tools/MSVC/*14.23.28105*/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual
Studio/2019/Professional/VC/Tools/MSVC/*14.23.28105*/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual
Studio/2019/Professional/VC/Tools/MSVC/*14.23.28105*/bin/Hostx64/x64/cl.exe
-- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual
Studio/2019/Professional/VC/Tools/MSVC/*14.23.28105*/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual
Studio/2019/Professional/VC/Tools/MSVC/*14.23.28105*/bin/Hostx64/x64/cl.exe
-- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done



---

Thanks,
Caleb
-- 

Powered by kitware.com/cmake

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

Visit other Kitware open-source projects at https://www.kitware.com/platforms

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

This mailing list is deprecated in favor of https://discourse.cmake.org


Re: [CMake] add my own language-name using standard functions

2019-07-19 Thread J. Caleb Wherry
Also, I would not suggest using the Java language support as reference as
it is not a first class supported language. As you said, it defines custom
functions and macros to do everything.

I would suggest you look at the C# support as it is a first class language
(meaning: you can add it to your project statement along with C and CXX or
use enable language). It is only supported for the Visual Studio Generator
but it should give you a lot better starting point than the Java stuff.

-Caleb

On Fri, Jul 19, 2019 at 4:43 PM Kyle Edwards 
wrote:

> On Fri, 2019-07-19 at 21:30 +0100, hex wrote:
> > dear community,
> > I want to make a module for a language that is not supported by
> > CMake.
> > are there any restrictions in using add_executable for any language
> > other than C / C++,
> > must the build be constructed very similar to C language?
> > I was looking into Java module for reference and noted that it is
> > defining its own functions for build. Since overriding standard CMake
> > functions is discouraged and add_executable seems to be hard coded
> > (not a CMake module) I believe that I have to create my own functions
> > like add_verilog_configuration, target_link_verilog_library and
> > alike.
>
> All of the languages have different rules for building, linking, etc.
> and many of these rules are encoded in native C++ rather than in CMake
> script.
>
> If you would like to add Verilog support to CMake, please open an issue
> on GitLab so we can track the progress.
>
> Kyle
> --
>
> 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
>
-- 
Sent from my iPhone SE
-- 

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] ALL_BUILD with msbuild

2019-05-13 Thread J. Caleb Wherry
Can’t help much on the ZERO_CHECK project, we set the
CMAKE_SUPPRESS_REGENERATION to true which disables that project.

-Caleb

On Mon, May 13, 2019 at 2:35 PM Dustyn Blasig  wrote:

> Ah, thanks, we do use EXCLUDE_FROM_ALL but I did not know about
> EXCLUDE_FROM_DEFAULT_BUILD. From the documentation, it sounds like we
> really do want to build the ALL_BUILD target, but I'm not sure how to get
> the ZERO_CHECK project to properly build with msbuild. I can probably use
> EXCLUDE_FROM_DEFAULT_BUILD as a workaround in the meantime, though.
>
> On Mon, May 13, 2019 at 1:15 PM J. Caleb Wherry 
> wrote:
>
>> I do not specify the project name when running my main build, I call
>> msbuild like you do in #2.
>>
>> How do you exclude things from ‘all’? I’ve actually ran into issues with
>> VS and how pressing “Build” in the IDE and running on the command line do
>> different things. This comes down to 2 target properties: EXCLUDE_FROM_ALL
>> and EXCLUDE_FROM_DEFAULT_BUILD.
>>
>> These each do different things so I ended up setting them both to true
>> for all my tests. Give that a shot and see what happens along with the #2
>> way of calling msbuild.
>>
>> -Caleb
>>
>> On Mon, May 13, 2019 at 1:05 PM Dustyn Blasig  wrote:
>>
>>> Hi All,
>>>
>>> I'm trying to switch from devenv to msbuild on the command line so we
>>> can use the /m parallel build option. On devenv, I just build the ALL_BUILD
>>> target and it builds properly. However, on msbuild, there are two issues.
>>>
>>> 1. If I specify the ALL_BUILD target on the command line directly, I get
>>> the following errors. (... used to remove large paths)
>>>
>>> *c:\tmp\...>msbuild c:\tmp\...\mysolution.sln /t:ALL_BUILD 
>>> /p:Configuration=Release /m || goto :ERROR
>>> *Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
>>> Copyright (C) Microsoft Corporation. All rights reserved.
>>>
>>> Build started 5/10/2019 1:01:52 PM.
>>>  1>Project "c:\tmp\...\mysolution.sln" on node 1 (ALL_BUILD target(s)).
>>>  1>ValidateSolutionConfiguration:
>>>  Building solution configuration "Release|x64".
>>>ValidateProjects:
>>>  The project "ALL_BUILD" is not selected for building in solution 
>>> configuration "Release|x64".
>>>  The project "Continuous" is not selected for building in solution 
>>> configuration "Release|x64".
>>>  The project "Experimental" is not selected for building in 
>>> solution configuration "Release|x64".
>>>  The project "Nightly" is not selected for building in solution 
>>> configuration "Release|x64".
>>>  The project "NightlyMemoryCheck" is not selected for building in 
>>> solution configuration "Release|x64".
>>>  The project "RUN_TESTS" is not selected for building in solution 
>>> configuration "Release|x64".
>>>
>>>  ...
>>>  1>Project "c:\tmp\...\mysolution.sln" (1) is building 
>>> "...\myproj.vcxproj.metaproj" (2) on node 1 (ALL_BUILD target(s)).* 
>>> 2>Project "c:\tmp\...\myproj.vcxproj.metaproj" (2) is building 
>>> "c:\tmp\...\ZERO_CHECK.vcxproj" (54) on node 2 (ALL_BUILD target(s)).
>>> *54>c:\tmp\...\ZERO_CHECK.vcxproj : error MSB4057: The target 
>>> "ALL_BUILD" does not exist in the project.
>>> 54>Done Building Project "c:\tmp\...\ZERO_CHECK.vcxproj" (ALL_BUILD 
>>> target(s)) -- FAILED.
>>>  2>Done Building Project "c:\tmp\...\myproj.vcxproj.metaproj" 
>>> (ALL_BUILD target(s)) -- FAILED.
>>>  1>Done Building Project "c:\tmp\...\mysolution.sln" (ALL_BUILD 
>>> target(s)) -- FAILED.
>>>
>>> Build FAILED.
>>>
>>>"c:\tmp\...\mysolution.sln" (ALL_BUILD target) (1) ->
>>>"c:\tmp\...\myproj.vcxproj.metaproj" (ALL_BUILD target) (2) ->
>>>"c:\tmp\...\ZERO_CHECK.vcxproj" (ALL_BUILD target) (54) ->
>>>  c:\tmp\...\ZERO_CHECK.vcxproj : error MSB4057: The target 
>>> "ALL_BUILD" does not exist in the project.
>>>
>>> 0 Warning(s)
>>> 1 Error(s)
>>>
>>>
>>> What is different with the ALL_BUILD target between msbuild and devenv?
>>&g

Re: [CMake] ALL_BUILD with msbuild

2019-05-13 Thread J. Caleb Wherry
I do not specify the project name when running my main build, I call
msbuild like you do in #2.

How do you exclude things from ‘all’? I’ve actually ran into issues with VS
and how pressing “Build” in the IDE and running on the command line do
different things. This comes down to 2 target properties: EXCLUDE_FROM_ALL
and EXCLUDE_FROM_DEFAULT_BUILD.

These each do different things so I ended up setting them both to true for
all my tests. Give that a shot and see what happens along with the #2 way
of calling msbuild.

-Caleb

On Mon, May 13, 2019 at 1:05 PM Dustyn Blasig  wrote:

> Hi All,
>
> I'm trying to switch from devenv to msbuild on the command line so we can
> use the /m parallel build option. On devenv, I just build the ALL_BUILD
> target and it builds properly. However, on msbuild, there are two issues.
>
> 1. If I specify the ALL_BUILD target on the command line directly, I get
> the following errors. (... used to remove large paths)
>
> *c:\tmp\...>msbuild c:\tmp\...\mysolution.sln /t:ALL_BUILD 
> /p:Configuration=Release /m || goto :ERROR
> *Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> Build started 5/10/2019 1:01:52 PM.
>  1>Project "c:\tmp\...\mysolution.sln" on node 1 (ALL_BUILD target(s)).
>  1>ValidateSolutionConfiguration:
>  Building solution configuration "Release|x64".
>ValidateProjects:
>  The project "ALL_BUILD" is not selected for building in solution 
> configuration "Release|x64".
>  The project "Continuous" is not selected for building in solution 
> configuration "Release|x64".
>  The project "Experimental" is not selected for building in solution 
> configuration "Release|x64".
>  The project "Nightly" is not selected for building in solution 
> configuration "Release|x64".
>  The project "NightlyMemoryCheck" is not selected for building in 
> solution configuration "Release|x64".
>  The project "RUN_TESTS" is not selected for building in solution 
> configuration "Release|x64".
>
>  ...
>  1>Project "c:\tmp\...\mysolution.sln" (1) is building 
> "...\myproj.vcxproj.metaproj" (2) on node 1 (ALL_BUILD target(s)).* 
> 2>Project "c:\tmp\...\myproj.vcxproj.metaproj" (2) is building 
> "c:\tmp\...\ZERO_CHECK.vcxproj" (54) on node 2 (ALL_BUILD target(s)).
> *54>c:\tmp\...\ZERO_CHECK.vcxproj : error MSB4057: The target "ALL_BUILD" 
> does not exist in the project.
> 54>Done Building Project "c:\tmp\...\ZERO_CHECK.vcxproj" (ALL_BUILD 
> target(s)) -- FAILED.
>  2>Done Building Project "c:\tmp\...\myproj.vcxproj.metaproj" (ALL_BUILD 
> target(s)) -- FAILED.
>  1>Done Building Project "c:\tmp\...\mysolution.sln" (ALL_BUILD 
> target(s)) -- FAILED.
>
> Build FAILED.
>
>"c:\tmp\...\mysolution.sln" (ALL_BUILD target) (1) ->
>"c:\tmp\...\myproj.vcxproj.metaproj" (ALL_BUILD target) (2) ->
>"c:\tmp\...\ZERO_CHECK.vcxproj" (ALL_BUILD target) (54) ->
>  c:\tmp\...\ZERO_CHECK.vcxproj : error MSB4057: The target 
> "ALL_BUILD" does not exist in the project.
>
> 0 Warning(s)
> 1 Error(s)
>
>
> What is different with the ALL_BUILD target between msbuild and devenv? I
> must be calling things improperly on the command line, but I'm not sure
> what.
>
> 2. If I instead leave ALL_BUILD off and just let it build the defaults, it
> gets further, but it also trys to build targets that are not enabled with
> the "all" target by default like our unit tests which we add through a
> hierarchy of targets like "run_tests_...".
>
> *c:\tmp\...>msbuild c:\tmp\...\mysolution.sln /p:Configuration=Release /m || 
> goto :ERROR
> *
>
>
> Should calling msbuild on just the solution build only the "all" target by
> default, or does mbuild just build everything in the solution ignoring the
> "all" target stuff?
>
> Thanks!
> --
>
> 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
>
-- 
Sent from my iPhone SE
-- 

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: 

Re: [CMake] CMake Project Generation Speedup

2019-03-20 Thread J. Caleb Wherry
I was also surprised when "cmake --trace" gave 0 information related to the
generate step. I assume this is expected behavior?

Oh and:

CMake: 3.13.4
Visual Studio 2017 15.9.9
Win7

-Caleb

On Wed, Mar 20, 2019 at 4:53 PM J. Caleb Wherry 
wrote:

> Did anything ever come of this?
>
> I am in a similar boat: we have >800 targets on our full build (native
> C++, Managed C++, C#, Java, CUDA, etc) and the majority of the time for the
> configure/generate steps takes place in the generate step (>70%).
>
> I understand there is a lot of IO since the generate step has to write the
> project files and filters for each C++ project (the majority of our
> projects) for VS generators (what we use). I'm just looking to see if there
> is anything to look at or potentially speedup up the generate step besides
> "get a faster drive".
>
> Thanks!
> -Caleb
>
> On Thu, Nov 17, 2016 at 11:15 AM Damian  wrote:
>
>> Hi all,
>>
>> We are still in the process of switching our large Make-based build to
>> CMake. One of the issues we're running into is the time it takes to reparse
>> and regenerate the CMake project (whether ninja, VS, or make) after
>> touching any CMake file. To give you an idea, we have about 1000 targets
>> and that takes a good 2 min for CMake to rerun.
>>
>> Are there any plans to speed this up? Maybe parallelize it in some way or
>> do a better job regenerating only what needs regenerating? Is there
>> anything we can do on our side to reduce our regeneration times?
>>
>> For example, if using a VS generator, each directory in the source that
>> has a CMakeLists.txt gets a .vcproj and .sln generated. Ideally, if I touch
>> one of those CMakeLists.txt, only that .sln/.vcproj would get regenerated.
>>
>> Thanks for any help.
>> --
>>
>> 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:
>> http://public.kitware.com/mailman/listinfo/cmake
>
>
>
> --
> J. Caleb Wherry
> *Scientific Software Engineer*
>
> <http://www.calebwherry.com>
> http://www.calebwherry.com
> +1 (615) 708-5651
> calebwhe...@gmail.com
>


-- 
J. Caleb Wherry
*Scientific Software Engineer*

<http://www.calebwherry.com>
http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.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] CMake Project Generation Speedup

2019-03-20 Thread J. Caleb Wherry
Did anything ever come of this?

I am in a similar boat: we have >800 targets on our full build (native C++,
Managed C++, C#, Java, CUDA, etc) and the majority of the time for the
configure/generate steps takes place in the generate step (>70%).

I understand there is a lot of IO since the generate step has to write the
project files and filters for each C++ project (the majority of our
projects) for VS generators (what we use). I'm just looking to see if there
is anything to look at or potentially speedup up the generate step besides
"get a faster drive".

Thanks!
-Caleb

On Thu, Nov 17, 2016 at 11:15 AM Damian  wrote:

> Hi all,
>
> We are still in the process of switching our large Make-based build to
> CMake. One of the issues we're running into is the time it takes to reparse
> and regenerate the CMake project (whether ninja, VS, or make) after
> touching any CMake file. To give you an idea, we have about 1000 targets
> and that takes a good 2 min for CMake to rerun.
>
> Are there any plans to speed this up? Maybe parallelize it in some way or
> do a better job regenerating only what needs regenerating? Is there
> anything we can do on our side to reduce our regeneration times?
>
> For example, if using a VS generator, each directory in the source that
> has a CMakeLists.txt gets a .vcproj and .sln generated. Ideally, if I touch
> one of those CMakeLists.txt, only that .sln/.vcproj would get regenerated.
>
> Thanks for any help.
> --
>
> 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:
> http://public.kitware.com/mailman/listinfo/cmake



-- 
J. Caleb Wherry
*Scientific Software Engineer*

<http://www.calebwherry.com>
http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.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] CMake Dependence on C: drive?

2019-02-19 Thread J. Caleb Wherry
Seems strange. Just yesterday I pulled down 3.13.4 and had no issues. I
check cmake into our repo so it gets invoked on an assortment of different
drives. I do the same thing you do and just change our bat config file to
point to the new cmake binary. Never had any issues.

I am running on Win7 but colleagues use Win10 and have not had any issues
either.

All that to say: shouldn’t be an issue.

-Caleb

On Tue, Feb 19, 2019 at 5:05 PM Michael Jackson 
wrote:

> Currently using CMake 3.13.3 on Windows 10. I have “installed” cmake
> through the .zip download and placed it in E:\DREAM3D_SDK\ 
> cmake-3.13.3-win64-x64.
>
>
>
>
> If I now try to use that cmake to configure my source codes I get very
> strange errors (It cannot parse a simple project command) and then
> complains that it cannot find a CMake_MAKE_PROGRAM matching the “-G Ninja”.
>
>
>
> I then went back to using the same version of CMake, but placed on the
> C:/DREAM3D_SDK/cmake-3.13.3-win64-x64 and now everything works as in the
> past, no problems. I have a .bat file that sets up my environment with
> needed paths and such. The ONLY difference between the 2 invocations was
> that I changed the path to reflect the alternate location of CMake. I can
> have 2 difference command prompts open based on this difference and one
> works and one does not.
>
>
> Was/Is there a known limitation where CMake _*must*_ be run from the C:
> drive?
>
>
>
> --
>
> Michael Jackson | Owner, President
>
>   BlueQuartz Software
>
> [e] mike.jack...@bluequartz.net
>
> [w] www.bluequartz.net
> --
>
> 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
>
-- 
Sent from my iPhone SE
-- 

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] Concurrency issues with copy_if_different

2018-12-08 Thread J. Caleb Wherry
Our case is pretty simplified in that almost every executable uses the
dependent DLLs/SOs I need copied. For C# apps it is log4net, NDesk.Options,
etc. For native apps it’s fmpeg shared libraries.

So when I create the list at configure time, I immediately just use CMake
to copy the files the where I want them in the build tree. This guarantees
that they are copied the one time when CMake is run instead of at build
time.

A few things that make this work for us:

* These libraries are checked into our repo so they aren’t changed by
automatically pulling new binaries or anything like that.

* We only have a handful of these dependent 3rd party libs, like 7.

* Couldn’t think of a better way to do it.

If you did want to move it to build time instead of configure time, you’d
just have to make a custom target that every other target depends on. In
some systems this isn’t easy but if you write wrappers around creating
targets then you can do extra book keeping when a target is create. In this
case, you just add another depends on the custom target that copies the
dependent libs.

-Caleb

On Sat, Dec 8, 2018 at 7:14 PM Olivier Croquette  wrote:

> On 2018-7-12 15:16, J. Caleb Wherry wrote:
> >> in one of our projects, we use copy_if_different to copy some DLLs
> >> required by the runtime. It's called as post-build action. The problem
> >> is that several targets want to copy the same DLLs, and when using
> >> parallelized builds, the different "cmake -E copy_if_different" can
> >> conflict, leading the whole build to fail.
> >>
> >> I see two options to fix this:
> >>
> >> 1. don't use copy_if_different, but a custom tool that can deal with the
> >> concurrency
> >>
> >> 2. instead of adding post-build actions to different targets, fill up a
> >> list containing all the files required, and add a single post-build
> >> action to a single target that copies all the required files in one go
> >>
> >> What do you think?
> > Had the same problem and went with #2
>
> Hi Caleb,
>
> could you give some more details how you did this? Filling up the list
> is easy, but I am not sure how to define the final action that will copy
> all the DLLs, and make sure it happens only once. Did you define a new
> custom target for that?
>
>
> --
Sent from my iPhone SE
-- 

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] Why does CMake 3.9.0 open VS2017 when targeting 2013 after installing 2017... sigh.

2018-10-01 Thread J. Caleb Wherry
The Visual C++ team sheds a little more light on this:

https://blogs.msdn.microsoft.com/vcblog/2018/10/01/cuda-10-is-now-available-with-support-for-the-latest-visual-studio-2017-versions/

Glad they listened to the community and worked with NVIDIA to make this
work.

We’ve been holding off migrating from VS2015 to VS2017 because of the pain
points with CUDA so I’m glad it’s (hopefully) behind us.

-Caleb

On Thu, Sep 20, 2018 at 8:46 AM Robert Maynard 
wrote:

> In news CUDA 10 release notes include the statement:
>
> - Starting with CUDA 10.0, nvcc supports all versions of Visual Studio
> 2017 (past and upcoming updates)
>
> So the problems of matching VS versions and CUDA versions should be behind
> us.
>
> On Sat, Aug 18, 2018 at 11:56 AM Brian Davis  wrote:
>
>>
>> With CUDA 8.0 and 9.0 installed and Visual Stuido 2013 (and god only
>> knows what versions of 2017 updated up grades with whatever tools versions)
>>
>>
>> CMake -> Visual Studio 12 2013 Win64 -> Optional toolset to use
>> (arguments to -T -> cuda=8.0
>>
>> The CXX compiler identification is MSVC 18.0.31101.0
>>
>> The CUDA compiler identification is NVIDIA 8.0.60
>>
>> Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual
>> Studio 12.0/VC/bin/x86_amd64/cl.exe
>>
>> Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual
>> Studio 12.0/VC/bin/x86_amd64/cl.exe -- works
>>
>> Detecting CXX compiler ABI info
>>
>> Detecting CXX compiler ABI info - done
>>
>> Detecting CXX compile features
>>
>> Detecting CXX compile features - done
>>
>> Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing
>> Toolkit/CUDA/v8.0/bin/nvcc.exe
>>
>> Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing
>> Toolkit/CUDA/v8.0/bin/nvcc.exe -- works
>>
>> Detecting CUDA compiler ABI info
>>
>> Detecting CUDA compiler ABI info - done
>>
>> Found OpenGL: opengl32
>>
>>
>> So, ok finds CUDA 8.0 nvcc
>>
>>
>> CMake -> Visual Studio 15 2017 Win64 -> Optional toolset to use
>> (arguments to -T -> cuda=8.0
>>
>> Selecting Windows SDK version 10.0.17134.0 to target Windows 10.0.16299.
>>
>> The CXX compiler identification is MSVC 19.15.26726.0
>>
>> The CUDA compiler identification is unknown
>>
>> Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual
>> Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x64/cl.exe
>>
>> Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual
>> Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x64/cl.exe --
>> works
>>
>> Detecting CXX compiler ABI info
>>
>> Detecting CXX compiler ABI info - done
>>
>> Detecting CXX compile features
>>
>> Detecting CXX compile features - done
>>
>> CMake Error at CMakeLists.txt:14 (PROJECT):
>> No CMAKE_CUDA_COMPILER could be found.
>>
>>
>> Though I am pretty sure it's there
>>
>>
>> Directory of c:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin
>>
>> 08/15/2018 06:47 PM  .
>> 08/15/2018 06:47 PM  ..
>> 09/02/2017 08:45 AM 163,840 bin2c.exe
>> 08/15/2018 06:46 PM  crt
>> 07/10/2018 04:50 PM 60,549,120 cublas64_90.dll
>> 09/02/2017 08:45 AM 347,136 cuda-memcheck.exe
>> 09/02/2017 08:45 AM 3,930,112 cudafe++.exe
>> 09/02/2017 08:45 AM 4,226,048 cudafe.exe
>> 09/02/2017 08:46 AM 299,520 cudart32_90.dll
>> 09/02/2017 08:46 AM 373,760 cudart64_90.dll
>> 08/15/2018 10:07 AM 288,159,744 cudnn64_7.dll
>> 09/02/2017 08:46 AM 131,197,952 cufft64_90.dll
>> 09/02/2017 08:46 AM 199,680 cufftw64_90.dll
>> 09/02/2017 08:46 AM 3,575,808 cuinj32_90.dll
>> 09/02/2017 08:46 AM 4,495,360 cuinj64_90.dll
>> 09/02/2017 08:45 AM 1,411,072 cuobjdump.exe
>> 09/02/2017 08:46 AM 48,057,344 curand64_90.dll
>> 09/02/2017 08:46 AM 75,222,016 cusolver64_90.dll
>> 09/02/2017 08:46 AM 54,782,464 cusparse64_90.dll
>> 09/02/2017 08:45 AM 246,784 fatbinary.exe
>> 09/02/2017 08:46 AM 1,274,880 gpu-library-advisor.exe
>> 09/02/2017 08:46 AM 205,824 nppc64_90.dll
>> 09/02/2017 08:46 AM 9,744,384 nppial64_90.dll
>> 09/02/2017 08:46 AM 3,953,664 nppicc64_90.dll
>> 09/02/2017 08:46 AM 1,035,264 nppicom64_90.dll
>> 09/02/2017 08:46 AM 7,291,392 nppidei64_90.dll
>> 09/02/2017 08:46 AM 55,641,088 nppif64_90.dll
>> 09/02/2017 08:46 AM 26,491,904 nppig64_90.dll
>> 09/02/2017 08:46 AM 4,767,232 nppim64_90.dll
>> 09/02/2017 08:46 AM 14,943,232 nppist64_90.dll
>> 09/02/2017 08:46 AM 179,200 nppisu64_90.dll
>> 09/02/2017 08:46 AM 2,629,120 nppitc64_90.dll
>> 09/02/2017 08:46 AM 9,024,512 npps64_90.dll
>> 07/10/2018 04:49 PM 241,664 nvblas64_90.dll
>> *09/02/2017 08:45 AM 325,632 nvcc.exe*
>> 09/02/2017 08:45 AM 328 nvcc.profile
>> 09/02/2017 08:45 AM 16,261,120 nvdisasm.exe
>> 09/02/2017 08:46 AM 15,747,584 nvgraph64_90.dll
>> 09/02/2017 08:45 AM 7,202,304 nvlink.exe
>> 09/02/2017 08:45 AM 4,005,376 nvprof.exe
>> 09/02/2017 08:45 AM 181,248 nvprune.exe
>> 09/02/2017 08:46 AM 3,182,592 nvrtc-builtins64_90.dll
>> 09/02/2017 08:46 AM 17,302,016 nvrtc64_90.dll
>> 09/02/2017 08:46 AM 53 nvvp.bat
>> 05/16/2018 04:16 PM 7,082,496 

Re: [CMake] Project referring to CSharp project generates incorrectly?

2018-08-16 Thread J. Caleb Wherry
Also, this ticket seems to be very similar to what you are seeing if you
dig down a bit:

https://gitlab.kitware.com/cmake/cmake/issues/17678

But again, I do this exact same thing with Shared instead of Module
libraries and it works. I would think that modules shouldn’t even be
allowed for C# targets as that is a specific notion to open native libs
with dlopen(). That ticket even hints at only allowing specific target
types, possible module was just overlooked?

-Caleb

On Thu, Aug 16, 2018 at 6:55 PM J. Caleb Wherry 
wrote:

> FWIW: I do almost this exact thing currently and have no issues (even mix
> in Managed C++ wrappers around naive code). The only difference is that I
> don’t compile any C# modules, only Shared libs. Not sure if that could be a
> problem or not.
>
> I’m using CMake 3.11 and VS 2015.
>
> -Caleb
>
> On Thu, Aug 16, 2018 at 5:46 PM Craig Scott 
> wrote:
>
>> Philip, thanks for the concise description of the problem. Would you be
>> willing to report this in CMake's gitlab as an issue so we can better track
>> it and refer to it in merge requests, etc.? You can report a new issue here:
>>
>> https://gitlab.kitware.com/cmake/cmake/issues/new
>>
>> Thanks
>>
>>
>> On Fri, Aug 17, 2018 at 1:59 AM, Tessier, Philip @ Engility via CMake <
>> cmake@cmake.org> wrote:
>>
>>> All,
>>>
>>> Thank you in advance,
>>>
>>>
>>> I'm an experienced CMake user, in the C++ realm. I'm presently working
>>> outside that realm, porting a 200-project solution from Visual Studio
>>> (.vcxproj, .csproj) files to CMake. I'm very pleased that CMake has adopted
>>> CSharp! Thank you!
>>>
>>>
>>> I seem to have uncovered a bug where one CSharp project depends on
>>> another.
>>>
>>>
>>> The first CMakeLists.txt:
>>> cmake_minimum_required(VERSION 3.12)
>>> project(DockPanel CSharp)
>>> ...
>>> add_library(DockPanel MODULE ${SOURCES_files_Compile}
>>> ${SOURCES_files_EmbeddedResource})
>>> set_property(TARGET DockPanel APPEND PROPERTY VS_DOTNET_REFERENCES
>>> "System")
>>>
>>>
>>> The second CMakeLists.txt:
>>> cmake_minimum_required(VERSION 3.12)
>>> project(CSharpFramework CSharp)
>>> ...
>>> add_library(CSharpFramework MODULE ${SOURCES_files_Compile}
>>> ${SOURCES_files_EmbeddedResource})
>>> target_link_libraries(CSharpFramework PUBLIC
>>> $<$:DockPanel>  )
>>> set_property(TARGET CSharpFramework APPEND PROPERTY VS_DOTNET_REFERENCES
>>> "System")
>>>
>>> (I haven't shown everything, as I'm extracting these from a huge system,
>>> but I can elaborate if necessary...)
>>>
>>> CMake configures and generates (to VS2015) without error. Things proceed
>>> as expected until it's time to link the second project.
>>> Then, I get:
>>> ..\DockPanel\Debug\DockPanel.dll : fatal error LNK1107: invalid or
>>> corrupt file: cannot read at 0x358
>>>
>>> A bit of investigative work shows that the generated
>>> CSharpFramework.vcxproj contains, as expected:
>>> >> Include="D:\Havok\hk2014_2_5_Simulation\Source\build-x64-msvc-v140-\Vision\Editor\vForge\DockPanel\DockPanel.vcxproj">
>>>   {DCCB7EE9-726F-3D42-A673-D6CCB4EF6675}
>>>   DockPanel
>>> 
>>>
>>> But, it also contains:
>>> 
>>> ..\DockPanel\Release\DockPanel.dll;
>>> ...
>>> ...
>>> 
>>>
>>> The inclusion of DockPanel.dll in the AdditionalDependencies section is,
>>> I believe, causing Visual Studio to try to open it as a '.lib', and
>>> failing. I expected the generated .vcxproj to contain only the
>>> ProjectReference section for DockPanel, and not include it in
>>> AdditionalDependencies.
>>>
>>> Can you confirm that this is a bug?
>>>
>>> Thank you,
>>> Phil
>>>
>>>
>>> --
>>>
>>> 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.htm

Re: [CMake] Project referring to CSharp project generates incorrectly?

2018-08-16 Thread J. Caleb Wherry
FWIW: I do almost this exact thing currently and have no issues (even mix
in Managed C++ wrappers around naive code). The only difference is that I
don’t compile any C# modules, only Shared libs. Not sure if that could be a
problem or not.

I’m using CMake 3.11 and VS 2015.

-Caleb

On Thu, Aug 16, 2018 at 5:46 PM Craig Scott  wrote:

> Philip, thanks for the concise description of the problem. Would you be
> willing to report this in CMake's gitlab as an issue so we can better track
> it and refer to it in merge requests, etc.? You can report a new issue here:
>
> https://gitlab.kitware.com/cmake/cmake/issues/new
>
> Thanks
>
>
> On Fri, Aug 17, 2018 at 1:59 AM, Tessier, Philip @ Engility via CMake <
> cmake@cmake.org> wrote:
>
>> All,
>>
>> Thank you in advance,
>>
>>
>> I'm an experienced CMake user, in the C++ realm. I'm presently working
>> outside that realm, porting a 200-project solution from Visual Studio
>> (.vcxproj, .csproj) files to CMake. I'm very pleased that CMake has adopted
>> CSharp! Thank you!
>>
>>
>> I seem to have uncovered a bug where one CSharp project depends on
>> another.
>>
>>
>> The first CMakeLists.txt:
>> cmake_minimum_required(VERSION 3.12)
>> project(DockPanel CSharp)
>> ...
>> add_library(DockPanel MODULE ${SOURCES_files_Compile}
>> ${SOURCES_files_EmbeddedResource})
>> set_property(TARGET DockPanel APPEND PROPERTY VS_DOTNET_REFERENCES
>> "System")
>>
>>
>> The second CMakeLists.txt:
>> cmake_minimum_required(VERSION 3.12)
>> project(CSharpFramework CSharp)
>> ...
>> add_library(CSharpFramework MODULE ${SOURCES_files_Compile}
>> ${SOURCES_files_EmbeddedResource})
>> target_link_libraries(CSharpFramework PUBLIC $<$:DockPanel>
>>   )
>> set_property(TARGET CSharpFramework APPEND PROPERTY VS_DOTNET_REFERENCES
>> "System")
>>
>> (I haven't shown everything, as I'm extracting these from a huge system,
>> but I can elaborate if necessary...)
>>
>> CMake configures and generates (to VS2015) without error. Things proceed
>> as expected until it's time to link the second project.
>> Then, I get:
>> ..\DockPanel\Debug\DockPanel.dll : fatal error LNK1107: invalid or
>> corrupt file: cannot read at 0x358
>>
>> A bit of investigative work shows that the generated
>> CSharpFramework.vcxproj contains, as expected:
>> > Include="D:\Havok\hk2014_2_5_Simulation\Source\build-x64-msvc-v140-\Vision\Editor\vForge\DockPanel\DockPanel.vcxproj">
>>   {DCCB7EE9-726F-3D42-A673-D6CCB4EF6675}
>>   DockPanel
>> 
>>
>> But, it also contains:
>> 
>> ..\DockPanel\Release\DockPanel.dll;
>> ...
>> ...
>> 
>>
>> The inclusion of DockPanel.dll in the AdditionalDependencies section is,
>> I believe, causing Visual Studio to try to open it as a '.lib', and
>> failing. I expected the generated .vcxproj to contain only the
>> ProjectReference section for DockPanel, and not include it in
>> AdditionalDependencies.
>>
>> Can you confirm that this is a bug?
>>
>> Thank you,
>> Phil
>>
>>
>> --
>>
>> 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
>>
>>
>
>
> --
> Craig Scott
> Melbourne, Australia
> https://crascit.com
>
> New book released: Professional CMake: A Practical Guide
> 
> --
>
> 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
>
-- 
Sent from my iPhone 4s
-- 

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 

Re: [CMake] Expected behaviour of #cmakedefine

2018-08-15 Thread J. Caleb Wherry
I suppose it all depends on if there are situations where you don’t want
those variables set? To me, it doesn’t make sense to ever not have version
numbers set so I would use #define.

-Caleb

On Wed, Aug 15, 2018 at 8:32 AM Ian Cullen 
wrote:

> Hi,
>
> I'm trying to create a header file containing version number details but
> am not sure if the following behaviour is expected or a bug.
>
> Simplified example has 2 files
>
> ==> CMakeLists.txt <==
> cmake_minimum_required(VERSION 3.11)
> project (
>VersionTest
>VERSION 1.0.4
>)
>
> configure_file (
>"${PROJECT_SOURCE_DIR}/config.h.in"
>"${PROJECT_BINARY_DIR}/config.h"
>@ONLY
>)
>
> ==> config.h.in <==
> #cmakedefine VersionTest_VERSION_MAJOR @VersionTest_VERSION_MAJOR@
> #cmakedefine VersionTest_VERSION_MINOR @VersionTest_VERSION_MINOR@
> #define VersionTest_VERSION_MINOR @VersionTest_VERSION_MINOR@
>
>
> Running cmake creates the output file as required but it has the
> following contents
>
> ==> config.h <==
> #define VersionTest_VERSION_MAJOR 1
> /* #undef VersionTest_VERSION_MINOR */
> #define VersionTest_VERSION_MINOR 0
>
>
> Looking at the manual
> (https://cmake.org/cmake/help/v3.12/command/configure_file.html), this
> appears to be because the number '0' is considered false by the if()
> command, however '0' is valid within a version number, so perhaps should
> not be considered false in this context.
>
> Is this a known issue? Is it recommended to use #define rather than
> #cmakedefine for these types of files?
>
> Thanks
>
> --
>
> 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
>
-- 
Sent from my iPhone 4s
-- 

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] Fwd: GLOB_RECURSE

2018-07-25 Thread J. Caleb Wherry
Latest CMake documentation can be found here:

https://cmake.org/cmake/help/latest/

Searching for GLOB_RECURSE there leads to this page:

https://cmake.org/cmake/help/latest/command/file.html

Which is the command you are using. Docs for the command and option you are
using are here:

https://cmake.org/cmake/help/latest/command/file.html?highlight=glob_recurse#glob-recurse

As for your issue, you are misunderstanding the purpose of RELATIVE. That
means the paths you get path will be relative to that path, not that it
searches from that path. So you are just searching for “*.cpp” and “*.c” in
the CURRENT directory. That is why you are getting files in all the
subdirs. As @frodak pointed out in his first example, you need to remove
the RELATIVE and put the dir name you want like “./dir/*.cpp”.

Once you do that, you should be good to go. All of the above is explained
pretty clearly in the linked docs.

-Caleb

On Wed, Jul 25, 2018 at 9:57 PM Michael Hennebry <
michael.henne...@rivieranexus.com> wrote:

> -- Forwarded message --
> From: Michael Hennebry 
> Date: Wed, Jul 25, 2018 at 8:55 PM
> Subject: Re: [CMake] GLOB_RECURSE
> To: Andrew Bell 
>
>
> I'd thought I was clear.
> I want two lists of files, one from each of two directory trees.
> Maybe GLOB_RECURSE does not do that.
> If not, I can live without.
>
> What does it do?
>
> Maybe you have used cmake long enough for the answer to be obvious.
> I have to read documentation or ask people.
> The former has not been all that helpful.
>
> What I have been getting is what appears to be the same list twice.
> It includes files from three directory trees.
>
> On Wed, Jul 25, 2018 at 8:19 PM, Andrew Bell 
> wrote:
> > Michael,
> >
> > It's not clear what you're asking. You need to say what you're trying to
> > achieve, your expected result, and the result that you believe incorrect.
> >
> > On Wed, Jul 25, 2018, 9:02 PM Michael Hennebry
> >  wrote:
> >>
> >> frodak wrote:
> >> I think you want to try for absolute paths:
> >> file (GLOB_RECURSE ards ./ArduinoCore/src/*.cpp ./ArduinoCore/src/*.c)
> >> file (GLOB_RECURSE apps ./SensorUnit/*.cpp ./SensorUnit/*.c)
> >>
> >> relative paths from those directories:
> >> file (GLOB_RECURSE ards RELATIVE  ./ArduinoCore/src/
> >> ./ArduinoCore/src/*.cpp ./ArduinoCore/src/*.c)
> >> file (GLOB_RECURSE apps RELATIVE ./SensorUnit/ ./SensorUnit/*.cpp
> >> ./SensorUnit/*.c)
> >> :frodak
> >>
> >> I do not understand either your constructions or mine.
> >> I do not know how cmake interprets any of them,
> >> nor how anyone would know.
> >> What documentation I can find, cmake.org, has not been helpful..
> >>
> >> Mike
> >>
> >>
> >> On Wed, Jul 25, 2018 at 7:02 PM, frodak  wrote:
> >> > I think you want to try for absolute paths:
> >> > file (GLOB_RECURSE ards ./ArduinoCore/src/*.cpp ./ArduinoCore/src/*.c)
> >> > file (GLOB_RECURSE apps ./SensorUnit/*.cpp ./SensorUnit/*.c)
> >> >
> >> > relative paths from those directories:
> >> > file (GLOB_RECURSE ards RELATIVE  ./ArduinoCore/src/
> >> > ./ArduinoCore/src/*.cpp
> >> > ./ArduinoCore/src/*.c)
> >> > file (GLOB_RECURSE apps RELATIVE ./SensorUnit/ ./SensorUnit/*.cpp
> >> > ./SensorUnit/*.c)
> >> >
> >> >
> >> >
> >> > On Wed, Jul 25, 2018 at 6:47 PM, Michael Hennebry
> >> >  wrote:
> >> >>
> >> >> Emphasis on curse.
> >> >>
> >> >> from CMakeLists.txt:
> >> >>
> >> >> file (GLOB_RECURSE ards ./ArduinoCore/src *.cpp *.c)
> >> >> file (GLOB_RECURSE apps ./SensorUnit *.cpp *.c)
> >> >>
> >> >> message("apps:;${apps};:apps")
> >> >> message("ards:;${ards};:ards")
> >> >>
> >> >> Both lists have ArduinoCore and SensorUnit sources.
> >> >> They both have precisely 57 entries.
> >> >> They both have three entries from sb-build.
> >> >>
> >> >> What is going on?
> >> >>
> >> >> From the siblings' parent:
> >> >> $ ls -F
> >> >> ArduinoCore/SensorUnit/  generic-gcc-avr.cmake
> >> >> CMakeLists.txt  from-build-directory.sh  sb-build/
> >> >>
> >> >> I tried RELATIVE.
> >> >> I tried replacing the dot with ${CMAKE_SOURCE_DIR}.
> >> >> All to no avail.
> >> >>
> >> >> I'm stumped.
> >> >> --
> >> >>
> >> >> 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
> >> >
> >> >
> >> --
> >>
> >> Powered by www.kitware.com
> >>
> >> Please keep messages on-topic and check the CMake FAQ at:
> 

Re: [CMake] Concurrency issues with copy_if_different

2018-07-12 Thread J. Caleb Wherry
Had the same problem and went with #2

-Caleb

On Thu, Jul 12, 2018 at 1:58 AM Olivier Croquette 
wrote:

> Hello,
>
> in one of our projects, we use copy_if_different to copy some DLLs
> required by the runtime. It's called as post-build action. The problem
> is that several targets want to copy the same DLLs, and when using
> parallelized builds, the different "cmake -E copy_if_different" can
> conflict, leading the whole build to fail.
>
> I see two options to fix this:
>
> 1. don't use copy_if_different, but a custom tool that can deal with the
> concurrency
>
> 2. instead of adding post-build actions to different targets, fill up a
> list containing all the files required, and add a single post-build
> action to a single target that copies all the required files in one go
>
> What do you think?
>
> Cheers
> Olivier
>
>
> --
>
> 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
>
-- 
Sent from my iPhone 4s
-- 

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] Cannot prevent import library from being created with VS generator

2018-07-09 Thread J. Caleb Wherry
I’m also interested in this.

Side note 1: Things like this eventually lead me to have a post process (a
python script) on all my VS project files to “fix” any issues like this. If
I can’t figure out a way to do something specific in a VS project, I just
add it to my post process until I eventually have time to dig in and figure
it out. For this specific issue, I just match a regex for the line and
remove it. I know this shouldn’t be neccessary but sometimes I just don’t
have the time to figure out a specific generator problem.

Side note 2: I also used this process at one point to make relocatable VS
solutions/projects. It worked quite well and is a quick way to get around
short comings in how CMake creates VS artifacts.

-Caleb

On Mon, Jul 9, 2018 at 6:49 PM Jason Heeris  wrote:

> I'm using CMake 3.12-rc1 on Windows 10. I have the following
> `CMakeLists.txt`:
>
> cmake_minimum_required(VERSION 3.8)
> project(cmake_test)
> unset(CMAKE_IMPORT_LIBRARY_SUFFIX)
> add_library(main MODULE "main.c")
>
> The generator is Visual Studio 15 2017.
>
> I would like to suppress the "/IMPLIB" argument created for the "main"
> library. In my real project, I have static and shared libraries named the
> same. This works fine, because they have different extensions (lib vs dll),
> but a problem arises when the linker tries to create an import library for
> "something.dll" named "something.lib", while also trying to link against a
> static library named "something.lib".
>
> The import library is not needed though; in CMake terminology the DLL is a
> "module" ie. loaded via DllOpen(). The documentation suggested that calling
> "add_library()" with "MODULE" was what I needed here. Unfortunately the
> resulting VS project still contains an import library flag for the linker.
>
> A Stackoverflow answer[1] suggested unsetting
> "CMAKE_IMPORT_LIBRARY_SUFFIX" because the source indicates[2] this will
> stop the flag from appearing. But all this seems to do is drop the filename
> from the generated project; it still contains this now-incorrect flag that
> references a directory instead of a full path:
>
> C:/Users/heerij/Code/cmake-ex-2/build/Debug/
>
> How do I prevent the import library creation?
>
> - Jason
>
>   [1]
> https://stackoverflow.com/questions/34575066/how-to-prevent-cmake-from-issuing-implib
>   [2]
> https://gitlab.kitware.com/cmake/cmake/blob/master/Source/cmComputeLinkInformation.cxx#L271
> --
>
> 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
>
-- 
Sent from my iPhone 4s
-- 

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] wix msi csharp dotnet project type

2018-07-09 Thread J. Caleb Wherry
If you set the WIN32_EXECUTABLE property on your WPF target then it will
have the behavior you are looking for.

-Caleb

On Mon, Jul 9, 2018 at 10:58 AM Petar Petrov 
wrote:

> I have gone through the cmake wix docs and in particular anything special
> about dotnet csharp projects, however I failed to find anything related to
> influencing the 'Output Type' of project's settings window inside visual
> studio!
>
> The options are: 'Console Application, Windows Application and Class
> Library', the generator defaults to Console Application while I do have a
> WPF windows only app, so I have an annoying console/terminal window in
> addition to the main-win. There are plenty of possible hack to influence
> the generated project file directly (which just a xml) but it is truly a
> job of the wix generator and I expected to be an easy straightforward way
> of setting it.
>
> Any tips and suggestions are welcomed!
>
> Thanks in advance,
> Peter
> --
>
> 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
>


-- 
J. Caleb Wherry
*Scientific Software Engineer*

<http://www.calebwherry.com>
http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.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 update librarian section of project properties for a visual studio project using cmake?

2018-05-15 Thread J. Caleb Wherry
If you want an official CMake response, take it from Brad King himself:

https://gitlab.kitware.com/cmake/cmake/issues/16931

His second comment is interesting, I haven't tried the path of trying to
trick it into thinking it is an object file. That might be the way to go!

-Caleb

On Tue, May 15, 2018 at 3:44 PM, Ritesh Singh <rinkuwithsi...@gmail.com>
wrote:

> Hi,
>
> I am creating a static library which in turn depends on several other
> libraries. So on Windows in Visual studio for my master library I have
> updated Librarian section of project properties to add the other libraries
> as additional dependencies. If I update Librarian section manually then I
> am able to create the master library successfully, but I am not able to
> figure out how to update Librarian from cmake. Now I want to do same
> thing using the cmake, I tried several options but nothing worked yet.
>
> Any help would be appreciated.
>
> I have posted these couple of questions and still waiting for the response:
>
> How to update Librarian section of project properties for a Visual studio
> project using cmake?
> https://stackoverflow.com/q/50346060/2657912?sem=2
>
> CMake not linking static library to other static libraries
> https://stackoverflow.com/q/50341118/2657912?sem=2
>
> Thank you!
>
> Regards,
> Ritesh
>
> --
>
> 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
>
>


-- 
J. Caleb Wherry
*Scientific Software Engineer*

<http://www.calebwherry.com>
http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.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 update librarian section of project properties for a visual studio project using cmake?

2018-05-15 Thread J. Caleb Wherry
You are unfortunately out of luck here. CMake does not provide built in
functionality to create "fat" static libs (multiple static libs combined).
Visual Studio allows this quite easily but CMake does not. All static libs
are considered transitive dependencies and get carried through to
executable and shared libs, they cannot be combined into a single static
lib target using the normal add_library and target_link_libraries calls.

It is possible to get a fat lib but you will have to use custom targets and
look into running the archiver directly (see CMAKE_AR). I did this once
upon a time and ran into a bunch of problems because I needed a
cross-platform solution. Things like [1] will get you down the right path
of using a custom target to get this to work.

-Caleb

[1]
https://stackoverflow.com/questions/14199708/cmake-include-library-dependencies-in-static-lib


On Tue, May 15, 2018 at 3:44 PM, Ritesh Singh <rinkuwithsi...@gmail.com>
wrote:

> Hi,
>
> I am creating a static library which in turn depends on several other
> libraries. So on Windows in Visual studio for my master library I have
> updated Librarian section of project properties to add the other libraries
> as additional dependencies. If I update Librarian section manually then I
> am able to create the master library successfully, but I am not able to
> figure out how to update Librarian from cmake. Now I want to do same
> thing using the cmake, I tried several options but nothing worked yet.
>
> Any help would be appreciated.
>
> I have posted these couple of questions and still waiting for the response:
>
> How to update Librarian section of project properties for a Visual studio
> project using cmake?
> https://stackoverflow.com/q/50346060/2657912?sem=2
>
> CMake not linking static library to other static libraries
> https://stackoverflow.com/q/50341118/2657912?sem=2
>
> Thank you!
>
> Regards,
> Ritesh
>
> --
>
> 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
>
>


-- 
J. Caleb Wherry
*Scientific Software Engineer*

<http://www.calebwherry.com>
http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.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] define addition search path for .cmake files

2018-02-17 Thread J. Caleb Wherry
https://cmake.org/cmake/help/latest/variable/CMAKE_MODULE_PATH.html#variable:CMAKE_MODULE_PATH

Should do the trick. Set it before you call project, not sure if it works
after that or not.

-Caleb

On Sat, Feb 17, 2018 at 7:47 AM  wrote:

>
>
> Hi!
>
> So, I have separate installation (root) path for a project, many libs
> there, installing their own *.cmake files (VTK,
> etc.) files into that root.
> How to define (add) alternative paths for cmake to search for *.cmake
> files?
> Testing environment variables without any effect (CMAKE_*).
> The idea to change original cmake files in each source package is not a
> good one.
>
>
> Thanx!
>
> --
>
> 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
>
-- 
Sent from my iPhone 4s
-- 

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 add files to Visual Studio 'Utility' project

2018-02-02 Thread J. Caleb Wherry
Agreed. If I don't here anything else about this, I'll write up a feature
request.

On Fri, Feb 2, 2018 at 9:50 AM, Eric Noulard <eric.noul...@gmail.com> wrote:

> There is some history on that:
>
> https://gitlab.kitware.com/cmake/cmake/issues/7835  linked to older
> https://itk.org/Bug/view.php?id=7835
>
> May be this is a plain feature request that should be properly written
> based on history and current usage.
> Typically I think that anyone would want to add any file to IDE project
> display.
>
>
> 2018-02-02 14:57 GMT+01:00 J. Caleb Wherry <calebwhe...@gmail.com>:
>
>> Yes, I understand that. The error message is pretty clear.
>>
>> My main question is really why is that the case? In VS, there is no
>> restriction to adding files to a utility project. So why does CMake have
>> this restriction?
>>
>> I assume it is because it is generator specific and there isn’t a clean
>> way to implement add_custom_target across all of them. In that case I would
>> expect some special case handling for generators that do support it.
>>
>> And it’s not like CMake can’t add files to that Utility project, because
>> it does: it adds the Java rules files. It just doesn’t allow the user the
>> do the same. It’s a restriction that doesn’t really make sense to me.
>>
>> -Caleb
>>
>> On Fri, Feb 2, 2018 at 3:35 AM CHEVRIER, Marc <marc.chevr...@sap.com>
>> wrote:
>>
>>> This approach is not possible for Java because the command add_jar is
>>> implemented using commands add_custom_command and add_custom_target. And
>>> command target_sources implies that the target was created by one the
>>> commands add_library or add_executable.
>>>
>>>
>>>
>>>
>>>
>>> *From: *CMake <cmake-boun...@cmake.org> on behalf of "J. Caleb Wherry" <
>>> calebwhe...@gmail.com>
>>> *Date: *Thursday 1 February 2018 at 19:30
>>> *To: *CMake ML <cmake@cmake.org>
>>> *Subject: *[CMake] How to add files to Visual Studio 'Utility' project
>>>
>>>
>>>
>>> Hello!
>>>
>>>
>>>
>>> I am having trouble with a generated VS project that I hope is either a
>>> bug or has an easy fix...
>>>
>>>
>>>
>>> When using UseJava, the add_jar function, and Visual Studio 2015, a VS
>>> 'Utility' project is created. I then want to add additional non-compiled
>>> files to this project so I try to use target_sources but get his error:
>>>
>>>
>>>
>>> "target_sources called with non-compilable target type"
>>>
>>>
>>>
>>> In VS, I can easily add files to the project without issue. But I cannot
>>> seem to add any additional files to this created 'Utility' project through
>>> CMake.
>>>
>>>
>>>
>>> I do this in other projects by using target_sources and setting the
>>> HEADER_FILE_ONLY and WRAP_EXCLUDE properties to make sure the project
>>> doesn't do anything with them and it works fine. Just can't do it for these
>>> Utility projects.
>>>
>>>
>>>
>>> My use case here is that the add_jar command doesn't actually add the
>>> java source files to the project. I want to use VS as a code editor in this
>>> case because it builds the jar. However, without them in the project, I
>>> have to go outside of VS to edit them (and thus outside of my VS perforce
>>> control).
>>>
>>>
>>>
>>> Thoughts? Maybe I am adding them incorrectly?
>>>
>>>
>>>
>>> -Caleb
>>>
>> --
>> Sent from my iPhone 4s
>>
>> --
>>
>> 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
>>
>>
>
>
> --
> Eric
>



-- 
J. Caleb Wherry
*Scientific Software Engineer*

<http://www.calebwherry.com>
http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.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 add files to Visual Studio 'Utility' project

2018-02-02 Thread J. Caleb Wherry
Yes, I understand that. The error message is pretty clear.

My main question is really why is that the case? In VS, there is no
restriction to adding files to a utility project. So why does CMake have
this restriction?

I assume it is because it is generator specific and there isn’t a clean way
to implement add_custom_target across all of them. In that case I would
expect some special case handling for generators that do support it.

And it’s not like CMake can’t add files to that Utility project, because it
does: it adds the Java rules files. It just doesn’t allow the user the do
the same. It’s a restriction that doesn’t really make sense to me.

-Caleb

On Fri, Feb 2, 2018 at 3:35 AM CHEVRIER, Marc <marc.chevr...@sap.com> wrote:

> This approach is not possible for Java because the command add_jar is
> implemented using commands add_custom_command and add_custom_target. And
> command target_sources implies that the target was created by one the
> commands add_library or add_executable.
>
>
>
>
>
> *From: *CMake <cmake-boun...@cmake.org> on behalf of "J. Caleb Wherry" <
> calebwhe...@gmail.com>
> *Date: *Thursday 1 February 2018 at 19:30
> *To: *CMake ML <cmake@cmake.org>
> *Subject: *[CMake] How to add files to Visual Studio 'Utility' project
>
>
>
> Hello!
>
>
>
> I am having trouble with a generated VS project that I hope is either a
> bug or has an easy fix...
>
>
>
> When using UseJava, the add_jar function, and Visual Studio 2015, a VS
> 'Utility' project is created. I then want to add additional non-compiled
> files to this project so I try to use target_sources but get his error:
>
>
>
> "target_sources called with non-compilable target type"
>
>
>
> In VS, I can easily add files to the project without issue. But I cannot
> seem to add any additional files to this created 'Utility' project through
> CMake.
>
>
>
> I do this in other projects by using target_sources and setting the
> HEADER_FILE_ONLY and WRAP_EXCLUDE properties to make sure the project
> doesn't do anything with them and it works fine. Just can't do it for these
> Utility projects.
>
>
>
> My use case here is that the add_jar command doesn't actually add the java
> source files to the project. I want to use VS as a code editor in this case
> because it builds the jar. However, without them in the project, I have to
> go outside of VS to edit them (and thus outside of my VS perforce control).
>
>
>
> Thoughts? Maybe I am adding them incorrectly?
>
>
>
> -Caleb
>
-- 
Sent from my iPhone 4s
-- 

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] CMake + mdvc + --build + jenkins

2018-02-01 Thread J. Caleb Wherry
(forgot to reply all)

I have a pretty similar setup but do not use the cmake --build since I
selectively build projects based the jenkins build type (CI, nightly,
research ,etc).

I'll see if I can kick off a test and use the --build option, I've thought
about doing that in the past but never tested. Will let you know if I see a
similar issue as you are seeing.

FWIW, I also set /nr:false so our setups are pretty close. I also build
Java and .NET wrappers in the same solution and sometimes have issues with
the .NET processes not ending when a build is done. I haven't investigated
those thoroughly though. So it is very possible something is screwed up
somewhere on either side.

-Caleb


On Thu, Feb 1, 2018 at 1:49 PM, Michael Ellery <mellery...@gmail.com> wrote:

> I know this is a long-shot, but I’m wondering if anyone has encountered
> this scenario:
>
> CMake (3.10) being used to generate a project for Visual Studio 15 (the
> current latest)
>
> the build is running on a windows machine under a jenkins slave process
>
> The generation step runs fine
>
> I then run cmake in build mode, and the build basically completes (based
> on the fact that I see the executable produced).  BUT the child MSBuild
> processes never exit and thus the build is stuck (cmake is still waiting…)
>
> I’ve tried running the jenkins slave process in a console window
> (foreground) just to eliminate any service/service account issues, but it
> makes no difference.
>
> More important, if I instead invoke MSBuild directly rather than use
> “cmake —build . ……”, the process behaves fine and runs to completion.
>
> This experiment makes me think something is odd about how cmake spawns the
> MSBuild process - perhaps some child event or signal is not being handled?
>
> In any event, I’m not blocked by this since I can simply run MSBUILD
> directly in the build script, but I wondered if this is a known issue or if
> others have encountered it.
>
> Also, I’ll note that I’m passing /nr:false to msbuild in both cases
> because that is common recommendation for running msbuild under CI.
>
> -Mike
>
>
> --
>
> 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
>
>


-- 
J. Caleb Wherry
*Scientific Software Engineer*

<http://www.calebwherry.com>
http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.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] How to add files to Visual Studio 'Utility' project

2018-02-01 Thread J. Caleb Wherry
Hello!

I am having trouble with a generated VS project that I hope is either a bug
or has an easy fix...

When using UseJava, the add_jar function, and Visual Studio 2015, a VS
'Utility' project is created. I then want to add additional non-compiled
files to this project so I try to use target_sources but get his error:

"target_sources called with non-compilable target type"

In VS, I can easily add files to the project without issue. But I cannot
seem to add any additional files to this created 'Utility' project through
CMake.

I do this in other projects by using target_sources and setting the
HEADER_FILE_ONLY and WRAP_EXCLUDE properties to make sure the project
doesn't do anything with them and it works fine. Just can't do it for these
Utility projects.

My use case here is that the add_jar command doesn't actually add the java
source files to the project. I want to use VS as a code editor in this case
because it builds the jar. However, without them in the project, I have to
go outside of VS to edit them (and thus outside of my VS perforce control).

Thoughts? Maybe I am adding them incorrectly?

-Caleb
-- 

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] SWIG_ADD_LIBRARY Documentation?

2017-12-09 Thread J. Caleb Wherry
I think you intuition is spot on here, I also think loading a static lib at
runtime is strange. That is why I always build the SWIG libs as shared.

To be honest, I don’t even know why static is an option. I’m sure there is
some case or reason but I wouldn’t ever build it as a static lib.

As for MODULE vs SHARED, here is a good answer:
https://stackoverflow.com/a/4968940. As the comments point out, it isn’t
obvious or documented what platforms this is actually for. On windows, you
get the same dll when you specify either.

If all the SWIG wrappers load the libraries dynamically (which glancing at
the examples it looks like they do), MODULE is more fitting. However since
I can’t find much on what platforms actually support this I don’t see the
point in using it over SHARED.

-Caleb

On Sat, Dec 9, 2017 at 2:26 PM Rob McDonald <rob.a.mcdon...@gmail.com>
wrote:

> Thanks much for your patient and detailed answers -- and sorry for
> dropping the mailing list.
>
> It seems very foreign to me to load a static library at runtime -- oh well.
>
> How is 'MODULE' different from 'SHARED' ?
>
> Rob
>
>
> On Sat, Dec 9, 2017 at 11:08 AM, J. Caleb Wherry <calebwhe...@gmail.com>
> wrote:
> > (Adding the CMake list back so others can reference it)
> >
> > FYI: I only use the CMake SWIG macros for Java wrappers so my reference
> is
> > for that.
> >
> > With Java, the Java wrapper SWIG creates does a load library on the
> library
> > created from the swig_add_library_call. So at the end of the day, it
> doesn’t
> > matter if it’s a shared or static library, the Java 8 JNI can load it. I
> > have no idea how python deals with the library created from this call.
> But
> > if it deals with loading the lib the same as Java, then it doesn’t
> matter.
> >
> > For our Java wrappers, I always compile shared libs. And as for mac, SWIG
> > has a special convention and names shared libs “name.jnilib”, not the
> > standard “name.dylib”.
> >
> > From a practical standpoint (and my opinion): shared libs are generally
> > better since they (usually) have a well defined interface and only
> include
> > the code needed for the lib’s interface. A static lib potentially leaks a
> > lot more about your build/files/etc instead of shared libs. Shared libs
> are
> > generally smaller too.
> >
> > -Caleb
> >
> > On Sat, Dec 9, 2017 at 1:00 PM Rob McDonald <rob.a.mcdon...@gmail.com>
> > wrote:
> >>
> >> Ok, thanks.
> >>
> >> In the context of a SWIG wrapper, what would happen if I chose STATIC?
> >>
> >> I assume it would result in 'mystuff.a' instead of 'mystuff.so' --
> >> would I then have to re-build Python and statically link that binding
> >> in to get it all to work?
> >>
> >> If I chose SHARED, would it result in 'mystuff.dylib' (on a Mac?).
> >>
> >> What is the practical difference of these choices?
> >>
> >> Rob
> >>
> >>
> >>
> >>
> >> On Sat, Dec 9, 2017 at 9:43 AM, J. Caleb Wherry <calebwhe...@gmail.com>
> >> wrote:
> >> > USE_BUILD_SHARED_LIB literally means use whatever is set by
> >> > BUILD_SHARED_LIBS. Typically, this is the preferred method for either
> >> > building a static or shared lib since the user can control what they
> >> > want/need. You don’t have to specify the type of lib to build when
> >> > calling
> >> > add_library, it uses shared if BUILD_SHARED_LIBS is true, otherwise
> >> > static.
> >> >
> >> > Otherwise you can specify the TYPE and the user can’t override it,
> they
> >> > always get the type of lib you set.
> >> >
> >> > -Caleb
> >> >
> >> > On Sat, Dec 9, 2017 at 12:23 PM Rob McDonald <
> rob.a.mcdon...@gmail.com>
> >> > wrote:
> >> >>
> >> >> In version 3.8, SWIG_ADD_MODULE was deprecated in favor of
> >> >> SWIG_ADD_LIBRARY.  This added the ability to control the TYPE for the
> >> >> target.  From the documentation, the options are this:
> >> >>
> >> >> https://cmake.org/cmake/help/v3.8/module/UseSWIG.html
> >> >>
> >> >> TYPE <SHARED|MODULE|STATIC|USE_BUILD_SHARED_LIBS>
> >> >>
> >> >> However, I can find no documentation of what these options mean and
> >> >> why someone would choose one over the other.
> >> >>
> >> >> I found some developer comments in KitWare's bug tracker proposing a
> >> >

Re: [CMake] SWIG_ADD_LIBRARY Documentation?

2017-12-09 Thread J. Caleb Wherry
(Adding the CMake list back so others can reference it)

FYI: I only use the CMake SWIG macros for Java wrappers so my reference is
for that.

With Java, the Java wrapper SWIG creates does a load library on the library
created from the swig_add_library_call. So at the end of the day, it
doesn’t matter if it’s a shared or static library, the Java 8 JNI can load
it. I have no idea how python deals with the library created from this
call. But if it deals with loading the lib the same as Java, then it
doesn’t matter.

For our Java wrappers, I always compile shared libs. And as for mac, SWIG
has a special convention and names shared libs “name.jnilib”, not the
standard “name.dylib”.

>From a practical standpoint (and my opinion): shared libs are generally
better since they (usually) have a well defined interface and only include
the code needed for the lib’s interface. A static lib potentially leaks a
lot more about your build/files/etc instead of shared libs. Shared libs are
generally smaller too.

-Caleb

On Sat, Dec 9, 2017 at 1:00 PM Rob McDonald <rob.a.mcdon...@gmail.com>
wrote:

> Ok, thanks.
>
> In the context of a SWIG wrapper, what would happen if I chose STATIC?
>
> I assume it would result in 'mystuff.a' instead of 'mystuff.so' --
> would I then have to re-build Python and statically link that binding
> in to get it all to work?
>
> If I chose SHARED, would it result in 'mystuff.dylib' (on a Mac?).
>
> What is the practical difference of these choices?
>
> Rob
>
>
>
>
> On Sat, Dec 9, 2017 at 9:43 AM, J. Caleb Wherry <calebwhe...@gmail.com>
> wrote:
> > USE_BUILD_SHARED_LIB literally means use whatever is set by
> > BUILD_SHARED_LIBS. Typically, this is the preferred method for either
> > building a static or shared lib since the user can control what they
> > want/need. You don’t have to specify the type of lib to build when
> calling
> > add_library, it uses shared if BUILD_SHARED_LIBS is true, otherwise
> static.
> >
> > Otherwise you can specify the TYPE and the user can’t override it, they
> > always get the type of lib you set.
> >
> > -Caleb
> >
> > On Sat, Dec 9, 2017 at 12:23 PM Rob McDonald <rob.a.mcdon...@gmail.com>
> > wrote:
> >>
> >> In version 3.8, SWIG_ADD_MODULE was deprecated in favor of
> >> SWIG_ADD_LIBRARY.  This added the ability to control the TYPE for the
> >> target.  From the documentation, the options are this:
> >>
> >> https://cmake.org/cmake/help/v3.8/module/UseSWIG.html
> >>
> >> TYPE <SHARED|MODULE|STATIC|USE_BUILD_SHARED_LIBS>
> >>
> >> However, I can find no documentation of what these options mean and
> >> why someone would choose one over the other.
> >>
> >> I found some developer comments in KitWare's bug tracker proposing a
> >> change of the default, but it looks like they left it as 'MODULE'.
> >> https://gitlab.kitware.com/cmake/cmake/merge_requests/253
> >>
> >> However, even which TYPE value is default appears undocumented.
> >>
> >> If we want to generalize from ADD_LIBRARY, we can get an idea of what
> >> some of the options generally mean:
> >> https://cmake.org/cmake/help/v3.0/command/add_library.html
> >>
> >> However, that says nothing for USE_BUILD_SHARED_LIBS -- which appears
> >> to be entirely unique to SWIG_ADD_LIBRARY.  It was also the proposed
> >> alternate default in the referenced proposal.
> >>
> >> So, can anyone explain in the context of SWIG/C++/Python, why I would
> >> want to choose SHARED, STATIC, or USE_BUILD_SHARED_LIBS?  What would
> >> be the practical impact on my wrapper, how it is built, its
> >> dependencies, etc.
> >>
> >> Thanks for any help,
> >>
> >> Rob
> >> --
> >>
> >> 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:
> >> http://public.kitware.com/mailman/listinfo/cmake
> >
> > --
> > Sent from my iPhone 4s
>
-- 
Sent from my iPhone 4s
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] SWIG_ADD_LIBRARY Documentation?

2017-12-09 Thread J. Caleb Wherry
USE_BUILD_SHARED_LIB literally means use whatever is set by
BUILD_SHARED_LIBS. Typically, this is the preferred method for either
building a static or shared lib since the user can control what they
want/need. You don’t have to specify the type of lib to build when calling
add_library, it uses shared if BUILD_SHARED_LIBS is true, otherwise static.

Otherwise you can specify the TYPE and the user can’t override it, they
always get the type of lib you set.

-Caleb

On Sat, Dec 9, 2017 at 12:23 PM Rob McDonald 
wrote:

> In version 3.8, SWIG_ADD_MODULE was deprecated in favor of
> SWIG_ADD_LIBRARY.  This added the ability to control the TYPE for the
> target.  From the documentation, the options are this:
>
> https://cmake.org/cmake/help/v3.8/module/UseSWIG.html
>
> TYPE 
>
> However, I can find no documentation of what these options mean and
> why someone would choose one over the other.
>
> I found some developer comments in KitWare's bug tracker proposing a
> change of the default, but it looks like they left it as 'MODULE'.
> https://gitlab.kitware.com/cmake/cmake/merge_requests/253
>
> However, even which TYPE value is default appears undocumented.
>
> If we want to generalize from ADD_LIBRARY, we can get an idea of what
> some of the options generally mean:
> https://cmake.org/cmake/help/v3.0/command/add_library.html
>
> However, that says nothing for USE_BUILD_SHARED_LIBS -- which appears
> to be entirely unique to SWIG_ADD_LIBRARY.  It was also the proposed
> alternate default in the referenced proposal.
>
> So, can anyone explain in the context of SWIG/C++/Python, why I would
> want to choose SHARED, STATIC, or USE_BUILD_SHARED_LIBS?  What would
> be the practical impact on my wrapper, how it is built, its
> dependencies, etc.
>
> Thanks for any help,
>
> Rob
> --
>
> 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:
> http://public.kitware.com/mailman/listinfo/cmake
>
-- 
Sent from my iPhone 4s
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

[CMake] C++/CLI Wrapper with C#

2017-09-20 Thread J. Caleb Wherry
All,

I recently upgraded to CMake 3.8 to get support for C# as a first class
language and it works nicely. However, I am seeking clarification on
something:

I currently compile my C++/CLI wrapper as a SHARED lib. This produces a
linking lib which I didn't expect and don't want (using the lib works fine
in my build with no issues). After reading the docs (
https://cmake.org/cmake/help/v3.8/command/add_library.html), it seems like
I should be compiling the lib as a MODULE since I do not want unmanaged
symbols exported.

However, when I change to MODULE and try to link that to a C# console app,
it doesn't work anymore, I get the "MODULE_LIBRARY may not be linked into
another target".

My question: am I doing something wrong here? What is the standard way to
build a C++/CLI lib and link it to a C# app?

Some things to note:

   - When I link to the C# app, I use target_link_libraries, I don't put it
   as a reference. I was hoping I could just use this macro and not have to
   explicitly place it as a reference.
   - My C++/CLI wrapper lib does have some public C symbols which I believe
   is causing the linking lib to be created so I will investigate that.
   However, that doesn't answer the question of how to correctly compile a
   C++/CLI lib.

If there isn't a simple answer, I can create a SSCCE (http://sscce.org/) to
replicate the issue I am having.

Thanks!
Caleb
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] CMake CUDA 3.8+/9 support as a first class language with out Visual Studio Support... err what?

2017-07-27 Thread J. Caleb Wherry
Not sure I understand your question but Visual Studio support just lagged a
version for that feature. It is available in CMake 3.9:

https://cmake.org/cmake/help/v3.9/release/3.9.html

Or are you asking before this version how was CUDA supported?

-Caleb

On Thu, Jul 27, 2017 at 9:07 PM Brian Davis  wrote:

>
> Can someone explain to me the meaning of the statement at:
>
> https://cmake.org/cmake/help/latest/release/3.8.html?highlight=cuda
>
>
> Make learned to support CUDA as a first-class language that can be enabled
> via the project() and enable_language() commands.
> CUDA is currently supported by the Makefile Generators and the Ninja
> generator on Linux, macOS, and Windows. *Support for the Visual Studio IDE
> is under development but not included in this release.*
> The NVIDIA CUDA Toolkit compiler (nvcc) is supported.
>
> Specifically:
>
> *Support for the Visual Studio IDE is under development but not included
> in this release.*
>
> Is CUDA as a first class language not supported for seemingly second class
> citizens such as Visual Studio?
> --
>
> 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:
> http://public.kitware.com/mailman/listinfo/cmake

-- 
Sent from my iPhone 4s
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] How to link shared lib on windows (visual studio 2014).

2016-04-25 Thread J. Caleb Wherry
(Shameless plug ahead)

If you want to see a working example of what I said above, you can check
out my ExampleCMakeProject:

https://github.com/calebwherry/example-cmake-project

It is currently being built and tested on TravisCI (Linux + Mac [GGC5 and
Clang3.7]) and Appveyor (Windows [VS2015]) and provides a simple example of
how to write/structure CMake for cross-platform C/C++ projects. You can
ignore the python wrapper if you want, it just makes working with the CMake
exe and system builds easier (calculates core counts, creates directories
for build, nicer CLI options, etc) since I find the options to CMake to be
very... verbose.

The POST_BUILD example is here:

https://github.com/calebwherry/example-cmake-project/blob/master/src/app/test-app/CMakeLists.txt

If you really are looking to get a one-off project working, Decker's
recommendation about PATH modification is easiest. It's just not something
I think is viable in the long run and doesn't work as an actual solution to
the problem if you are trying to solve it for many projects.

-Caleb

On Mon, Apr 25, 2016 at 9:01 PM, Chaos Zhang <zcsd2...@gmail.com> wrote:

> Hi,
>
> I faced this problem when i try built a shared lib  and linked it on
> windows. The structure of my project as below:
> -test_dir/
>  -sub_hello/
>CMakeLists.txt
>hello.c
>  -top/
>main.c
>CMakeLists.txt
>  CMakeLists.txt
>
> The content of each file:
> ①test_dir/CMakeLists.txt:
> PROJECT(TESTLIB)
> add_subdirectory(sub_hello sub_hello)
> add_subdirectory(top top)
>
> ②test_dir/sub_hello/CMakeLists.txt:
> message("message from sub_hello")
> add_library(hello_lib  SHARED hello.c)
>
> ③test_dir/top/CMakeLists.txt:
> include_directories(../sub_hello)
> add_executable(main main.c)
> target_link_libraries(main hello_lib)
>
> ④test_dir/sub_hello/hello.c:
> #include 
> void HelloFunc()
> {
> printf("###hello###\n");
> }
>
> ⑤test_dir/top/main.c:
> int main()
> {
> HelloFunc();
> return 0;
> }
>
> After i cmake this project, generated .sln and .proj files, then i built it
> and i get an error in vs:
>
> Error   LNK1104 can't open file "..\sub_hello\Debug\hello_lib.lib"
>
> In folder ..\sub_hello\Debug\ , there was not a hello_lib.lib existed.
> Then i look thorough and found a solution:
>
> Add "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES)" in file
> test_dir/sub_hello/hello.c
>
> Then i built this solution again, this time it success, and hello_lib.lib
> and main.exe was generated. But when i try to run main.exe, an error
> occured: "lose hello_lib.dll". And i moved hello_lib.dll into the folder of
> main.exe, and it worked well.
>
> There are two questions i could not figure out:
> ①Is this "..\sub_hello\Debug\hello_lib.lib" associates with
> "..\sub_hello\Debug\hello_lib.dll"? For windows can not use .dll directly,
> and use a .lib to record the .dll's  entrance and location.
> ②How to solve the problem of main.exe can not find .dll file.
>
> Best regards,
> Chao Zhang
>
>
>
>
>
> --
> View this message in context:
> http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346.html
> Sent from the CMake mailing list archive at Nabble.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:
> http://public.kitware.com/mailman/listinfo/cmake




-- 
J. Caleb Wherry
*Scientific Software Engineer*

<http://www.calebwherry.com>
http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] How to link shared lib on windows (visual studio 2014).

2016-04-25 Thread J. Caleb Wherry
Altering the path, updating the registry, or having a custom install step
that installs into a build location are all options that aren't scalable
since they apply specifically to the one project. Paths would get huge if
this was to be done in practice for multiple projects.

Also, the OP seems to building from VS so being able to press F5 and
everything just work is nice. Adding a POST_BULLD step that copies the DLL
to the build location of the exe is the best way to solve the problem.

Lastly, adding an install step just muddles what "install" means, IMO. You
aren't really installing anything, you are just building a project and you
want it to run after building. Installing brings a lot more baggage and
using it here seems like a bad idea.

-Caleb

On Monday, April 25, 2016, J Decker <d3c...@gmail.com> wrote:

>
> On Apr 25, 2016 6:41 PM, "J. Caleb Wherry" <calebwhe...@gmail.com
> <javascript:_e(%7B%7D,'cvml','calebwhe...@gmail.com');>> wrote:
> >
> > (1)
> >
> > You typically want to define the entry point in the source itself. You
> can use the 'CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS' in CMake but you usually do
> something like this in the source:
> >
> > #ifdef WIN32
> > #define PUBLIC_API __declspec(dllexport)
> > #else
> > #define PUBLIC_API
> > #endif
> >
> > PUBLIC_API void HelloFunc();
> >
> > That way when you are building a shared lib on windows it will export
> those symbols which in turn creates the .lib. Without the exported symbols,
> you will not have an import lib.
> >
> > (2)
> >
> > The missing DLL is a pain that you are just going to have to deal with
> unless you want to do a bunch of voodoo with the registry or copy the DLLs.
> Typically, there are POST_BUILD steps that copy the needed DLLs into the
> same directory as the exe. There are many stackoverflow questions dealing
> with this, first one googled here:
> >
>
> Could just set the path environment variable... No registry hack.. Or
> include install rules and just build install before running.
> >
> http://stackoverflow.com/questions/5765986/how-can-i-run-an-exe-with-dlls-in-separate-directory
> >
> > -Caleb
> >
> >
> > On Mon, Apr 25, 2016 at 9:01 PM, Chaos Zhang <zcsd2...@gmail.com
> <javascript:_e(%7B%7D,'cvml','zcsd2...@gmail.com');>> wrote:
> >>
> >> Hi,
> >>
> >> I faced this problem when i try built a shared lib  and linked it on
> >> windows. The structure of my project as below:
> >> -test_dir/
> >>  -sub_hello/
> >>CMakeLists.txt
> >>hello.c
> >>  -top/
> >>main.c
> >>CMakeLists.txt
> >>  CMakeLists.txt
> >>
> >> The content of each file:
> >> ①test_dir/CMakeLists.txt:
> >> PROJECT(TESTLIB)
> >> add_subdirectory(sub_hello sub_hello)
> >> add_subdirectory(top top)
> >>
> >> ②test_dir/sub_hello/CMakeLists.txt:
> >> message("message from sub_hello")
> >> add_library(hello_lib  SHARED hello.c)
> >>
> >> ③test_dir/top/CMakeLists.txt:
> >> include_directories(../sub_hello)
> >> add_executable(main main.c)
> >> target_link_libraries(main hello_lib)
> >>
> >> ④test_dir/sub_hello/hello.c:
> >> #include 
> >> void HelloFunc()
> >> {
> >> printf("###hello###\n");
> >> }
> >>
> >> ⑤test_dir/top/main.c:
> >> int main()
> >> {
> >> HelloFunc();
> >> return 0;
> >> }
> >>
> >> After i cmake this project, generated .sln and .proj files, then i
> built it
> >> and i get an error in vs:
> >>
> >> Error   LNK1104 can't open file "..\sub_hello\Debug\hello_lib.lib"
> >>
> >> In folder ..\sub_hello\Debug\ , there was not a hello_lib.lib existed.
> >> Then i look thorough and found a solution:
> >>
> >> Add "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES)" in file
> >> test_dir/sub_hello/hello.c
> >>
> >> Then i built this solution again, this time it success, and
> hello_lib.lib
> >> and main.exe was generated. But when i try to run main.exe, an error
> >> occured: "lose hello_lib.dll". And i moved hello_lib.dll into the
> folder of
> >> main.exe, and it worked well.
> >>
> >> There are two questions i could not figure out:
> >> ①Is this "..\sub_hello\Debug\hello_lib.lib" associates with
> >> &quo

Re: [CMake] How to link shared lib on windows (visual studio 2014).

2016-04-25 Thread J. Caleb Wherry
(1)

You typically want to define the entry point in the source itself. You can
use the 'CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS' in CMake but you usually do
something like this in the source:

#ifdef WIN32
#define PUBLIC_API __declspec(dllexport)
#else
#define PUBLIC_API
#endif

PUBLIC_API void HelloFunc();

That way when you are building a shared lib on windows it will export those
symbols which in turn creates the .lib. Without the exported symbols, you
will not have an import lib.

(2)

The missing DLL is a pain that you are just going to have to deal with
unless you want to do a bunch of voodoo with the registry or copy the DLLs.
Typically, there are POST_BUILD steps that copy the needed DLLs into the
same directory as the exe. There are many stackoverflow questions dealing
with this, first one googled here:

http://stackoverflow.com/questions/5765986/how-can-i-run-an-exe-with-dlls-in-separate-directory

-Caleb


On Mon, Apr 25, 2016 at 9:01 PM, Chaos Zhang <zcsd2...@gmail.com> wrote:

> Hi,
>
> I faced this problem when i try built a shared lib  and linked it on
> windows. The structure of my project as below:
> -test_dir/
>  -sub_hello/
>CMakeLists.txt
>hello.c
>  -top/
>main.c
>CMakeLists.txt
>  CMakeLists.txt
>
> The content of each file:
> ①test_dir/CMakeLists.txt:
> PROJECT(TESTLIB)
> add_subdirectory(sub_hello sub_hello)
> add_subdirectory(top top)
>
> ②test_dir/sub_hello/CMakeLists.txt:
> message("message from sub_hello")
> add_library(hello_lib  SHARED hello.c)
>
> ③test_dir/top/CMakeLists.txt:
> include_directories(../sub_hello)
> add_executable(main main.c)
> target_link_libraries(main hello_lib)
>
> ④test_dir/sub_hello/hello.c:
> #include 
> void HelloFunc()
> {
> printf("###hello###\n");
> }
>
> ⑤test_dir/top/main.c:
> int main()
> {
> HelloFunc();
> return 0;
> }
>
> After i cmake this project, generated .sln and .proj files, then i built it
> and i get an error in vs:
>
> Error   LNK1104 can't open file "..\sub_hello\Debug\hello_lib.lib"
>
> In folder ..\sub_hello\Debug\ , there was not a hello_lib.lib existed.
> Then i look thorough and found a solution:
>
> Add "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES)" in file
> test_dir/sub_hello/hello.c
>
> Then i built this solution again, this time it success, and hello_lib.lib
> and main.exe was generated. But when i try to run main.exe, an error
> occured: "lose hello_lib.dll". And i moved hello_lib.dll into the folder of
> main.exe, and it worked well.
>
> There are two questions i could not figure out:
> ①Is this "..\sub_hello\Debug\hello_lib.lib" associates with
> "..\sub_hello\Debug\hello_lib.dll"? For windows can not use .dll directly,
> and use a .lib to record the .dll's  entrance and location.
> ②How to solve the problem of main.exe can not find .dll file.
>
> Best regards,
> Chao Zhang
>
>
>
>
>
> --
> View this message in context:
> http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346.html
> Sent from the CMake mailing list archive at Nabble.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:
> http://public.kitware.com/mailman/listinfo/cmake




-- 
J. Caleb Wherry
*Scientific Software Engineer*

<http://www.calebwherry.com>
http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] Howto install executables that aren't targets

2016-03-09 Thread J. Caleb Wherry
To Eric's point: your destination for these files should probably be "bin"
and not "/usr/bin". That way from CPack you can set the "
CPACK_INSTALL_PREFIX" to point to the actual place you want to install your
project.

But everything still comes down to this: if your above prefix is "/usr"
then someone needs write access to that directory. Typically on unix with
makefiles the install step is run with "sudo" so that it can write to that
location. If you are doing an actual install to the system, then you have
to run it with sudo (or give you current user elevated permissions).

-Caleb

On Wed, Mar 9, 2016 at 11:31 AM, Winfried <winku...@arcor.de> wrote:

> Hi J Decker,
>
> sorry I've missed your answer, while I wrote mine.
>
> Now I used install( PROGRAMS ...instead of FILES
> but I can't see any difference in the output. The error message is exactly
> the same as in my last reply.
> To be sure that it is not a cache problem, I deleted the 'build' dir and
> made a completely new build by:
> cmake ..
> make
> make package
>
>
>
>
> --
> View this message in context:
> http://cmake.3232098.n2.nabble.com/Howto-install-executables-that-aren-t-targets-tp7592951p7592957.html
> Sent from the CMake mailing list archive at Nabble.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:
> http://public.kitware.com/mailman/listinfo/cmake
>



-- 
J. Caleb Wherry
*Scientific Software Engineer*

<http://www.calebwherry.com>
http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] Howto install executables that aren't targets

2016-03-09 Thread J. Caleb Wherry
"install(FILES..." should work, that is how you install non-target files.
Are you sure it isn't a permission issue? Do other install commands work
that copy to /usr/bin?

We'll need a little more information to diagnose the issue, an simple CMake
example would be nice.

Caleb

On Wednesday, March 9, 2016, Winfried  wrote:

> Hi,
> the build system of a qt-based visual robot programming teaching platform
> shall be ported from autotools to cmake.
> For the build process of the platform the underlying compilers and some
> shell scripts aiming diffenent robot targets are not built but just have to
> be installed (copied) to /usr/bin.
>
> I tried different ways to do this:
> install(FILES  DESTINATION /usr/bin)
> ->  file INSTALL cannot copy file
>   "/opt/build/tuxminds_3.96_cmake/tools/tuxm_aar-04_make.sh" to
>   "/usr/bin/tuxm_aar-04_make.sh".
>
> install(TARGETS  RUNTIME DESTINATION /usr/bin)
> ->  install TARGETS given target "tuxm_aar-04_make.sh" which does not
> exist in
>   this directory.
>
> install(TARGETS ${CMAKE_CURRENT_SOURCE_DIR}/
> ${CMAKE_CURRENT_SOURCE_DIR}/
> ...
> RUNTIME DESTINATION /usr/bin)
> ->  install TARGETS given target
>   "/opt/build/tuxminds_3.96_cmake/tools/tuxm_aar-04_make.sh" which
>   does not exist in this directory.
>
> (The files are located in ${CMAKE_CURRENT_SOURCE_DIR} .)
>
> So, I would be glad, if someone could help me with this topic.
> Thanks in advance!
> Winfried
>
>
>
>
> --
> View this message in context:
> http://cmake.3232098.n2.nabble.com/Howto-install-executables-that-aren-t-targets-tp7592951.html
> Sent from the CMake mailing list archive at Nabble.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:
> http://public.kitware.com/mailman/listinfo/cmake
>


-- 
Sent from my iPhone 4s
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] CMAKE_DL_LIBS

2016-03-01 Thread J. Caleb Wherry
That link looks fine to me. You might want to verify that the CMAKE_DL_LIBS
variable actually contains what it should on your system (or a least
contains what it should right before using it).

You could explicitly add the "-dl" to that link statement and see if that
works. That's what that variable should contain anyways on Linux boxes.

-Caleb

(Pasting off list response below)

Thanks, Caleb. Are you saying that I need to add "-ldl" link lib in
addition to ${CMAKE_DL_LIBS} ?


My CMake file is here:

https://github.com/GrokImageCompression/opendcp/blob/master/cli/CMakeLists.txt

and the lines for the exe that is not linking are found here:

TARGET_LINK_LIBRARIES(opendcp_j2k ${CMAKE_DL_LIBS} ${OPENDCP_LIB} )


This is an open source proj, by the way. I can send you a few short lines
about how to build on Ubuntu, if you are interested.

Thanks very much for your help.


Aaron

On Tuesday, March 1, 2016, Aaron Boxer  wrote:

>
>
> On Tue, Mar 1, 2016 at 9:06 AM, Aaron Boxer  > wrote:
>
>> Hello!
>> I have a CMAKE project that creates an executable that links with a
>> static lib
>> from a second CMAKE project. The static lib requires the dlopen and
>> dlclose
>> symbols.
>>
>> So, when I link the first project, I add ${CMAKE_DL_LIBS} to the CMake
>> file.
>>
>> However, I still get an error about "undefined reference to symbol
>> "dlclose"
>>
>
> The error states: "missing DSO from command line"
>
> Also, the second CMAKE project also contains executables that link with
> the static
> library, and they link with no problem.
>
>
>
>
>

-- 
Sent from my iPhone 4s
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] CMAKE_DL_LIBS

2016-03-01 Thread J. Caleb Wherry
Most likely solution: missing the "-ldl" link lib which should solve
your missing symbol issues.

The DSO error is most likely caused by the above. However, there could be a
problem with your linking order. I'd have to see the CMake file to be sure.

Caleb

On Tuesday, March 1, 2016, Aaron Boxer  wrote:

>
>
> On Tue, Mar 1, 2016 at 9:06 AM, Aaron Boxer  > wrote:
>
>> Hello!
>> I have a CMAKE project that creates an executable that links with a
>> static lib
>> from a second CMAKE project. The static lib requires the dlopen and
>> dlclose
>> symbols.
>>
>> So, when I link the first project, I add ${CMAKE_DL_LIBS} to the CMake
>> file.
>>
>> However, I still get an error about "undefined reference to symbol
>> "dlclose"
>>
>
> The error states: "missing DSO from command line"
>
> Also, the second CMAKE project also contains executables that link with
> the static
> library, and they link with no problem.
>
>
>
>
>

-- 
Sent from my iPhone 4s
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] Link errors - can I get more verbose messages?

2015-12-16 Thread J. Caleb Wherry
(forgot to reply-all)

First: looks like you aren't doing an out-of-source build. If OpenGL
expects an out-of-source build (not sure if it does), then you need to do
it that way otherwise things could get screwy:

$ mkdir build
$ cd build
$ cmake ${SRC_ROOT}
$ make VERBOSE=1

Second, the VERBOSE option to make should spit out a bunch of stuff. You'll
have to dig through to find the link lines but it would at least allow you
to grep for the lib to make sure it is actually linking against it.

-Caleb

On Wed, Dec 16, 2015 at 9:32 PM, DJ <ja...@arqux.com> wrote:

> I recently purchased the OpenGL SuperBible ed. 7. I downloaded the sample
> code and tried to build it.
>
> This is my very first exposure to cmake; I am reading through the
> documentation and did a quick scan of the gmane archive but cannot seem
> find an answer to my question. (Probably my fault; my search skills may be
> bad because I have been up programming for 30 hours :-P
>
> AFAIK there is no mailing list or forum for OpenGL SuperBible; could be
> wrong on this too.
>
> I am running Linux Mint 17.1.
>
> I did:
>
> cmake .
> make
>
> Then cmake gave output:
> .
> .
> .
> Linking CXX executable bin/alienrain
> CMakeFiles/alienrain.dir/src/alienrain/alienrain.cpp.o: In function
> `sb6::application::run(sb6::application*)':
> alienrain.cpp:(.text._ZN3sb611application3runEPS0_[_ZN3sb611application3runEPS0_]+0x21):
> undefined reference to `glfwInit'
>
> So "glfwInit" is a reference to an entrypoint in libglfw.so; this library
> exists on my machine at /usr/lib/libglfw.so. Moreover, when I do
>
> ldconfig -p
>
> I see that this library is listed.
>
> QUESTION: Is there a quick way to get cmake to generate more output about
> how it is linking the executable? Or do I have another problem?
>
> Best,
>
> -- Jake --
>
> --
>
> 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:
> http://public.kitware.com/mailman/listinfo/cmake
>



-- 
J. Caleb Wherry
*Scientific Software Engineer*

<http://www.calebwherry.com>
http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.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:
http://public.kitware.com/mailman/listinfo/cmake

[CMake] Imported libraries and cross platform target names

2015-08-18 Thread J. Caleb Wherry
CMAKE_IMPORT_LIBRARY_PREFIX and CMAKE_IMPORT_LIBRARY_POSTFIX should get you
what you want. Then you just have to have one set property:


 SET_PROPERTY(TARGET test PROPERTY IMPORTED_LOCATION
${LIB_D}/${CMAKE_IMPORT_LIBRARY_PREFIX}
timer.${CMAKE_IMPORT_LIBRARY_POSTFIX})

-Caleb

On Tuesday, August 18, 2015, Ette, Anthony (CDS) 
anthony.r.e...@controlsdata.com
javascript:_e(%7B%7D,'cvml','anthony.r.e...@controlsdata.com'); wrote:

 Given that add_library() produces a unique filename per platform (the “actual
 file name of the library built is constructed based on conventions of the
 native platform (such as libname.a orname.lib”), how does one add the
 library to the final application without having to deal with the filename
 difference?  In other words, I’ve got one library that, by default,
 produces ‘libtest.a’ on Linux and ‘test.lib’ on Windows.  How can I add
 this imported library into the final application in a cross platform
 manner?  I know I can specify two different imported locations (see below),
 but it seems odd to me that Cmake – the cross-platform build env generator
 – doesn’t have a better native way of dealing with this….



 The snippet below will work, but just seems wrong given the nature of what
 CMake is intended to do…is there a better way that I’m missing?!  If not,
 can I request that a future release of Cmake handle platform naming
 convention difference internally when invoking ADD_LIBRARY with the
 IMPORTED tag set?  Ok so, to be fair, Cmake can be used to cross compile
 and that certainly complicates my feature request but, when not cross
 compiling, CMake knows what platform it’s being executed on so it should be
 able to resolve static archive platform decorations internally.



 ADD_LIBRARY(test STATIC IMPORTED)

 if(WIN32)

SET_PROPERTY(TARGET test PROPERTY IMPORTED_LOCATION ${LIB_D}/timer.lib)

 endif()

 if(UNIX)

SET_PROPERTY(TARGET test PROPERTY IMPORTED_LOCATION
 ${LIB_D}/libtimer.a)

 endif()



 Thanks in advance,


 *Anthony Ette *Control Systems Engineer



 Rolls-Royce Controls and Data Services

 7661 N Perimeter Rd

 Indianapolis, IN 46241

 tel: +1 (317) 230-6943

 mob: +1 (317) 864-7975

 email: anthony.r.e...@controlsdata.com


 This e-mail (including attachments) contains contents owned by Rolls-Royce
 plc and its subsidiaries, affiliated companies or customers and covered by
 the laws of England and Wales, Brazil, US, or Canada (federal, state or
 provincial). The information contained in this email is intended to be
 confidential, may be legally privileged and subject to export controls
 which may restrict the access to and transfer of the information. If you
 are not the intended recipient, you are hereby notified that any retention,
 dissemination, distribution, interception or copying of this communication
 is strictly prohibited and may subject you to further legal action. Reply
 to the sender if you received this email by accident, and then delete the
 email and any attachments.



-- 
Sent from my iPhone 4s
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] (no subject)

2015-05-12 Thread J. Caleb Wherry
Uma,

There are a few ways to do this. As Martin said, CentOS has an ancient
version of CMake that ships with it and you can't update it with yum. So,
you have 3 options:

1. Use the version shipped with CentOS and deal with it being old.
2. Download the latest binary release script/tarball:
http://www.cmake.org/download/
3. Download, compile, and install from source: http://www.cmake.org/install/

I usually go with option 2 and get the shell script from the download page
for my architecture, it works pretty well. Hope that helps!

-Caleb

On Tue, May 12, 2015 at 4:17 PM, Martin Weber fifteenknots...@gmail.com
wrote:

 Am Dienstag, 12. Mai 2015, 20:32:48 schrieb Uma Devi:
  dear cmake user
  i am not able to updaate the cmake in one of my linux system. how can i
  update the cmake in centos

 Maybe because CentOS is still at cmake v 2.6?

 Martin

 --
 Cd wrttn wtht vwls s mch trsr.


 --

 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:
 http://public.kitware.com/mailman/listinfo/cmake




-- 
J. Caleb Wherry
*Scientific Software Engineer*

http://www.calebwherry.com
http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.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:
http://public.kitware.com/mailman/listinfo/cmake

[CMake] Switching configuration to icc

2015-05-10 Thread J. Caleb Wherry
Just to be explicit, CC and CXX are shell variables that CMake reads. So
invoke like below to make for sure they are getting set correctly:

export CC=icc; export CXX=icc; cmake args

Caleb

On Sunday, May 10, 2015, Rahul K Soni ra...@ismu.ac.in
javascript:_e(%7B%7D,'cvml','ra...@ismu.ac.in'); wrote:

 When I run like that it says CC=icc command not found.

 --
 Rahul Kumar Soni
 Scientist
 CSIR-IMMT

 Sent from iPad Rahul


 On Sun, May 10, 2015 at 11:06 PM, Tom Kacvinsky 
 tom.kacvin...@vectorcast.com wrote:





  On May 10, 2015, at 13:16, Rahul K Soni ra...@ismu.ac.in wrote:
 
  Hi Petr
 
  Is deleting the buildsysystem means deleting the CMakeCache.txt file.
 How to set CC and CXX before configuring.
 
  Thanks a lot in advance.

 Shoot, I had top posted. Yes, you need to delete the bus directory as
 cmake caches settings after the initial run. Once the build directory is
 deleted, you need to run cmake as follows:

 CC=icc CXX=icpc cmake options




-- 
Sent from my iPhone 4s
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] Install( Targets ) loses executable permission

2015-04-21 Thread J. Caleb Wherry
You can pass in the below variable to CMake (or set it in you CMake file)
and you should get what you want:

-DCMAKE_INSTALL_SO_NO_EXE=0

-Caleb

On Tue, Apr 21, 2015 at 10:01 PM, J Decker d3c...@gmail.com wrote:

 Basically this is the command I use to install some plugins...
 BINARY_OUTPUT_DIR is ${CMAKE_INSTALL_PREFIX}/bin
 project_target is a argument to the macro and it's 'plugins'


 install( TARGETS ${proj} ·
 RUNTIME DESTINATION ${BINARY_OUTPUT_DIR}/${project_target} ·
 LIBRARY DESTINATION ${BINARY_OUTPUT_DIR}/${project_target} ·
 ARCHIVE DESTINATION lib·
 )·


 (expanded example)
 install( TARGETS tasks.isp ·
 RUNTIME DESTINATION bin/plugins
 LIBRARY DESTINATION bin/plugins
 ARCHIVE DESTINATION lib·
 )·

 This is basically the target defintiion

 add_library(tasks.isp SHARED ${SOURCES} )
 SET_TARGET_PROPERTIES(tasks.isp PROPERTIES
   SUFFIX 
   PREFIX 
 )


 -
 the library is built 'tasks.isp' with rwxr-xr-x
 but it's installed with rw-r--r--

 (platform is rasberry pi)
 cmake version is 3.2.2 (custom build, version in apt-get is only 2.8
 something)



 --

 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:
 http://public.kitware.com/mailman/listinfo/cmake




-- 
J. Caleb Wherry
*Scientific Software Engineer*

http://www.calebwherry.com
http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] external project add, clone without history

2015-02-25 Thread J. Caleb Wherry
Actually, scratch my last comment and submodules. There looks to be a
GIT_SUBMODULES option that says if not given, all submodules will be
updated. I am assuming that means the CMake passes in the --recursive
option automatically when cloning. Haven't tested it yet though...

-Caleb

On Wed, Feb 25, 2015 at 9:50 AM, Miklos Espak m.es...@ucl.ac.uk wrote:

 Hi,

 is it possible to specify the --depth 1 argument in ExternalProject_Add
 for cloning projects from git?

 Cheers,
 Miklos


 --

 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:
 http://public.kitware.com/mailman/listinfo/cmake




-- 
J. Caleb Wherry
*Scientific Software Engineer*

http://www.calebwherry.com
http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] external project add, clone without history

2015-02-25 Thread J. Caleb Wherry
Miklos,

I did a quick test and using the DOWNLOAD_COMMAND option to
ExternalProject_Add works nicely:

ExternalProject_Add(sfml
  PREFIX ${sfml_PREFIX}
  DOWNLOAD_COMMAND git clone --depth 1
https://github.com/LaurentGomila/SFML.git
  INSTALL_DIR ${sfml_INSTALL_DIR}
  CMAKE_ARGS ${sfml_CMAKE_ARGS}
)

I could not, however, get it to work along with specifying the
GIT_REPOSITORY option. I believe this is because using the DOWNLOAD_COMMAND
completely overrides all other download options.

I think this is the best way to get what you want. I'm surprised no one
else has commented since cloning a git repo with submodules needs the
'recursive' option to actually pull in the submodule code. It's a similar
problem you are facing with needing to pass in extra options to the
download executable.

-Caleb

On Wed, Feb 25, 2015 at 9:50 AM, Miklos Espak m.es...@ucl.ac.uk wrote:

 Hi,

 is it possible to specify the --depth 1 argument in ExternalProject_Add
 for cloning projects from git?

 Cheers,
 Miklos


 --

 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:
 http://public.kitware.com/mailman/listinfo/cmake




-- 
J. Caleb Wherry
*Scientific Software Engineer*

http://www.calebwherry.com
http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] MinGW flags

2014-12-15 Thread J. Caleb Wherry
Very useful page for these types of questions:

http://www.cmake.org/Wiki/CMake_Useful_Variables

if (MINGW) should work.

Or if you want to go off the compiler id use: CMAKE_CXX_COMPILER_ID.

-Caleb

On Mon, Dec 15, 2014 at 11:16 AM, Petr Bena benap...@gmail.com wrote:

 Hi,

 Is it possible to set a compiler flags only if compiler is MinGW (that
 means these flags wouldn't be set on MSVC).

 if (WIN32) matches both compilers obviously. Thanks
 --

 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:
 http://public.kitware.com/mailman/listinfo/cmake



-- 
J. Caleb Wherry
*Scientific Software Engineer*

http://www.calebwherry.com
http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.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:
http://public.kitware.com/mailman/listinfo/cmake

[CMake] ExternalProject with target_link_library produces incorrect linking?

2014-12-09 Thread J. Caleb Wherry
Let's try again...

I submitted a question last week but got no responses so I have assumed my
question and/or example was not explicit enough. I have stripped out all
unnecessary structure from the code and am posing the question better (I
hope)...

The functionality that I am using is expressed in this old bug:
http://public.kitware.com/Bug/view.php?id=10395. I am adding dependencies
in my project based on an imported library which is built by
ExternalProject_add. Everything works but the linking is not as I would
expect. I add my imported library like so (see code for ExternalProject_add
statement):

add_library(ExtLib SHARED IMPORTED)
set_property(TARGET ExtLib PROPERTY IMPORTED_LOCATION
${CMAKE_BINARY_DIR}/${EXT_LIB_NAME})
add_dependencies(ExtLib ExtLibBuild)

I then link against this in my binary like so:

add_executable(testApp testApp.cpp)
target_link_libraries(testApp LINK_PUBLIC TestLib ExtLib)

However, when I do this, the binray that comes out has a relative path to
the 'ExtLib' which means I can only run it from the directory CMake builds
it in. When I change the linking to be the below with the full path to
ExtLib, it works just fine and I can run it from anywhere:

target_link_libraries(testApp LINK_PUBLIC TestLib
${CMAKE_BINARY_DIR}/${EXT_LIB_NAME})

I gave the full path to the imported library in the
set_property..IMPORTED_LOCATION... so I am unsure why the first one does
not work?

In this previous post from Brad in 2010 (
http://www.cmake.org/pipermail/cmake/2010-September/039639.html), it seems
that the first way should work like I want, correct?

A few other notes:
* I have my RPATH properties set which has been a factor in getting this to
work but I haven't tested enough to known which ones are actually helping
or not.
* The (more) SSCCE project is here:
https://github.com/calebwherry/cmake-SO-question-main.git
* I have also attached a tar'ed version.
* System specs: Debian Wheezy 64-bit, CMake 3.0.2, GCC 4.9.2.

Thanks,
Caleb

-- 
J. Caleb Wherry
*Scientific Software Engineer*

http://www.calebwherry.com
http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.com


cmake-SO-question-main.tar.gz
Description: GNU Zip compressed data
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] ExternalProject with target_link_library produces incorrect linking?

2014-12-09 Thread J. Caleb Wherry
Works like a charm, I knew I was overlooking something small. Thanks, Brad!

-Caleb

On Tue, Dec 9, 2014 at 2:30 PM, Brad King brad.k...@kitware.com wrote:

 On 12/09/2014 12:26 PM, J. Caleb Wherry wrote:
  add_library(ExtLib SHARED IMPORTED)
  set_property(TARGET ExtLib PROPERTY IMPORTED_LOCATION
 ${CMAKE_BINARY_DIR}/${EXT_LIB_NAME})
  add_dependencies(ExtLib ExtLibBuild)

 Thanks for the complete/simple example.  The problem is that
 the libExtLib.so file built by the external project does not
 have DT_SONAME set by the linker.  When a linker is given a
 path to a shared library file that has no soname then the path
 is copied into the DT_NEEDED field of the consumer since it
 has no soname to use for that.

 There are two solutions:

 1. Make sure DT_SONAME gets set properly by the external build system.

 2. Tell CMake that the imported library file has no soname:

 set_property(TARGET ExtLib PROPERTY IMPORTED_NO_SONAME 1)

CMake will then link it via -lExtLib and the linker will not
store the path to the file in DT_NEEDED but only the file name.

 Either of these should resolve the issue.  Number 1 is cleaner.

 -Brad




-- 
J. Caleb Wherry
*Scientific Software Engineer*

http://www.calebwherry.com
http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.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:
http://public.kitware.com/mailman/listinfo/cmake

[CMake] Linking Shared C++ Object from ExternalProject Produces Binaries with Relative Path, not Absolute

2014-12-02 Thread J. Caleb Wherry
All,

I've been beating my head over this for about 3 days now and haven't gotten
anywhere. There have been a few discussions on topics related to this
question but nothing has gotten me a 100% solution (yet). I have created a
StackOverflow post to see if I could get anything there but have yet to get
any hits yet:

http://stackoverflow.com/q/27261288/408160

My problem is this: I am using ExternalProject to add a project that gets
built by make. I want the libs that come out of this project to be linked
in with apps and libs I have in my project (I have created a sample project
here: https://github.com/calebwherry/cmake-superprj-main-test).

The external lib compiles correctly but the issue is with how it is linked
to my apps and libs: whenever I do ldd on them the path shows up as
relative for the external lib. This means that is cannot be run anywhere
but from the directory CMake puts it. Setting LD_LIBRARY_PATH or messing
with RPATH does not effect the external lib, it always shows up with a
relative path like so:

libTestLib.so =
/home/jwherry3/repos/cmake-superprj-main-test/build/src/lib/TestLib/libTestLib.so
(0x7f592da57000)
../../lib/libExtLib.so (0x7f592d855000)

The first lib (libTestLib.so) is the one built with CMake in the
superproject and the second (libExtLib.so) is the external lib. I have no
idea how to get it NOT to do this. I think it is potentially something
wrong with how I am interfacing with the ExternalProject target but am not
sure. The github example is fully compilable and exhibits the undesired
behavior (Debian Wheezy 64-bit, CMake 3.0.1, g++-4.9.2).

Thanks for the help!
Caleb

-- 
J. Caleb Wherry
*Scientific Software Engineer*

http://www.calebwherry.com
http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.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:
http://public.kitware.com/mailman/listinfo/cmake