Re: [CMake] Duplicate builds with target_sources

2018-11-20 Thread Wesley Smith
Thank you for the explanation Robert.

On Tue, Nov 20, 2018 at 7:34 AM Robert Maynard 
wrote:

> You have defined 4 && 5 as public sources so that means that consumers
> of mylib_core and mylib_core will build them. If you want the sources
> to be part of mylib_core the sources should be private, if you want
> the sources to be part of mylib_thing use interface. In general don't
> use PUBLIC with target_sources.
> On Tue, Nov 20, 2018 at 9:19 AM Wesley Smith 
> wrote:
> >
> > I have a library target defined as
> >
> >
> > add_library(mylib_core
> > core_source1.cpp
> > core_source2.cpp
> > core_source3.cpp
> > )
> >
> > if(UNIX)
> > target_sources(mylib_core PUBLIC
> > ${CMAKE_CURRENT_SOURCE_DIR}/core_source4.cpp
> > ${CMAKE_CURRENT_SOURCE_DIR}/core_source5.cpp
> > )
> > endif()
> >
> >
> > Then a target that uses it as a dependency:
> >
> >
> > add_library(mylib_thing
> > thing_source1.cpp
> > thing_source2.cpp
> > thing_source3.cpp
> > )
> >
> > target_link_libraries(mylib_thing
> > PUBLIC
> > mylib_core
> > )
> >
> > When building with static libs, I noticed that the sources defined on
> mylib_core with target_sources are building twice.
> >
> >
> > [ 60%] Building CXX object
> mylib_thing/CMakeFiles/mylib_thing.dir/thing_source1.cpp.o
> > [ 60%] Building CXX object
> mylib_thing/CMakeFiles/mylib_thing.dir/thing_source2.cpp.o
> > [ 60%] Building CXX object
> mylib_thing/CMakeFiles/mylib_thing.dir/thing_source3.cpp.o
> > [ 60%] Building CXX object
> mylib_thing/CMakeFiles/mylib_thing.dir/__/mylib_core/core_source4.cpp.o
> > [ 60%] Building CXX object
> mylib_thing/CMakeFiles/mylib_thing.dir/__/mylib_core/core_source5.cpp.o
> >
> > The last two source files were already built when mylib_core was built.
> Why are they being built again under mylib_thing?  When these files were
> defined in the add_library() call, this didn't happen.  Any thoughts?  Is
> it related to the PUBLIC v. PRIVATE enum?  If so, what is the setting on
> sources when defining them via add_library()?
> >
> > thanks,
> > wes
> >
> > --
> >
> > 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: 
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] Duplicate builds with target_sources

2018-11-20 Thread Wesley Smith
I have a library target defined as


add_library(mylib_core
core_source1.cpp
core_source2.cpp
core_source3.cpp
)

if(UNIX)
target_sources(mylib_core PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/core_source4.cpp
${CMAKE_CURRENT_SOURCE_DIR}/core_source5.cpp
)
endif()


Then a target that uses it as a dependency:


add_library(mylib_thing
thing_source1.cpp
thing_source2.cpp
thing_source3.cpp
)

target_link_libraries(mylib_thing
PUBLIC
mylib_core
)

When building with static libs, I noticed that the sources defined on
mylib_core with target_sources are building twice.


[ 60%] Building CXX object
mylib_thing/CMakeFiles/mylib_thing.dir/thing_source1.cpp.o
[ 60%] Building CXX object
mylib_thing/CMakeFiles/mylib_thing.dir/thing_source2.cpp.o
[ 60%] Building CXX object
mylib_thing/CMakeFiles/mylib_thing.dir/thing_source3.cpp.o
[ 60%] Building CXX object
mylib_thing/CMakeFiles/mylib_thing.dir/__/mylib_core/core_source4.cpp.o
[ 60%] Building CXX object
mylib_thing/CMakeFiles/mylib_thing.dir/__/mylib_core/core_source5.cpp.o

The last two source files were already built when mylib_core was built.
Why are they being built again under mylib_thing?  When these files were
defined in the add_library() call, this didn't happen.  Any thoughts?  Is
it related to the PUBLIC v. PRIVATE enum?  If so, what is the setting on
sources when defining them via add_library()?

thanks,
wes
-- 

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-developers] Embracing Modern CMake Video and Slides

2017-11-07 Thread Wesley Smith
Thanks for sharing!

On Sun, Nov 5, 2017 at 10:09 AM, Stephen Kelly  wrote:

> Hi,
>
> I know I'm not active here at the moment, but I thought this post might be
> interesting for some here:
>
>  https://steveire.wordpress.com/2017/11/05/embracing-modern-cmake/
>
> Thanks,
>
> Steve.
>
>
> --
>
> 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-developers
>
-- 

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-developers

Re: [cmake-developers] Make it easier for beginners

2017-10-25 Thread Wesley Smith
I agree that if you do a search for how to setup a project with cmake, it's
hard to know what's best practice.  As cmake has evolved, the best practice
has changed and many old style techniques still return toward the top of
search results.  For me, the best resources have been:

http://preshing.com/20170522/learn-cmakes-scripting-language-in-15-minutes/
https://www.youtube.com/watch?v=bsXLMQ6WgIk

I still don't understand the scoped syntax in Daniel Pfeifer's talk (e.g.
boost::boost).  And CPack was really opaque to me until I bought the cmake
book.  I wish there were better tutorials on CPack and on how to write
cmake scripts that play well as dependencies on other projects using cmake.

wes


On Sun, Oct 22, 2017 at 12:08 PM, Bill Hoffman 
wrote:

> On 10/21/2017 10:56 AM, Lectem wrote:
>
>> _Question :_ Would it possible to delete the wiki, or reset/reopen it ?
>>
>> _Reason:_ The wiki is full of old stuff, but we can't register to edit
>> stuff. Still, people willing to learn will end up visiting it, thinking it
>> gives good advice. "How could it not ? It's the official wiki". At the very
>> least I wish we could add a big red message stating it is outdated and not
>> updated anymore.
>>
>> The wiki is still open.  If people want to edit they have to send an
> email and let us know what they want to do.  It was too hard to keep the
> spam off of it otherwise.  So, send me an email off list and I can get you
> setup with a wiki account.
>
> -Bill
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensou
> rce/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake-developers
>
-- 

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-developers

[CMake] OBJECT Libraries and linking against targets

2017-08-11 Thread Wesley Smith
Hi,
I understand vaguely why OBJECT libraries can't link against other targets,
but I don't think the restriction in place needs to be so constrained.
Consider the following:

* A target is being create as an OBJECT library
* A number of other targets are defined as INTERFACE target where they only
set include paths, compiler options, etc.

How is it possible to communicate the dependencies expressed in an
INTERFACE target to an OBJECT library?  So far the only method I've found
that works is to use a handful of generator expressions, which seems like a
lot of work for something that would just work if I could "link" the
INTERFACE library against the OBJECT library.

Here's what I have to do:

target_compile_features(tgt PUBLIC
$
)
target_include_directories(tgt PUBLIC
$
)
target_compile_options(tgt PUBLIC
$
$
)
target_compile_definitions(tgt PUBLIC
$
)

thanks!
wes
-- 

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-developers] C++ IDE

2017-08-09 Thread Wesley Smith
I have been really impressed with VSCode .

On Sun, Aug 6, 2017 at 1:52 PM, Ivam Pretti  wrote:

> Can you recomend an IDE to code in C/C++?
>
> --
>
> 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-developers
>
-- 

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-developers

Re: [cmake-developers] VS Project Settings User Defines

2017-03-23 Thread Wesley Smith
The only reference I've been able to find to this property is via the
VisualStudio SDK https://msdn.microsoft.com/en-us/library/hh710870.aspx .
It doesn't seem to be part of any compiler configuration.  The conclusion
here being that none of the flags in the VS tables map to this XML tag.  I
wonder if the solution here is to add something like the VS_GLOBAL_ prefix
or somehow attach custom flags to a target config e.g. attach a flag to the
Debug|x64 config of target X.


  CustomValue


On Thu, Mar 23, 2017 at 7:51 AM, Brad King <brad.k...@kitware.com> wrote:

> On 03/23/2017 10:41 AM, Wesley Smith wrote:
> > Specifically, I'm trying to add these tags:
> >
> > ..\..\add-in.ruleset
> > true
> >
> > per-config tags are added via Flag arguments,
>
> What are the corresponding command-line flags that these add?
> If they appear in `Source/cmVS*CLFlagTable.h` then adding the
> flags in `CMAKE_C_FLAGS` or other places we support flags will
> reverse-map into the vcxproj file settings.
>
> -Brad
>
>
-- 

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-developers

[cmake-developers] VS Project Settings User Defines

2017-03-23 Thread Wesley Smith
Hi,
I'm trying to figure out if it's possible to add user defined XML entries
to the project config section of a visual studio file.  From what I can see
it's not, but maybe someone here know of a code path I haven't come across.

Specifically, I'm trying to add these tags:

..\..\add-in.ruleset
true

These are added on a per-config basis.  From what I can see, per-config
tags are added via Flag arguments, which are hard coded into the source.
Basically, I need to get some data into the FlagMap written by

void cmVisualStudioGeneratorOptions::OutputFlagMap(std::ostream& fout,
   const char* indent)

The tags written in its calling function
(cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesManaged)
are also hard coded, so I believe this is the only place possible for
dynamically generating tags.


Any ideas?

thanks!
wes
-- 

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-developers

Re: [CMake] C# Language Detection Errors in 3.8.0-rc2

2017-03-23 Thread Wesley Smith
Eventually I figured out the answer to this question after stepping through
the CMake project code.

DO:
enable_language(CSharp)

DONT:
enable_language(CSHARP)

Unlike C, CXX, FORTRAN, etc. CSharp is not an abbreviation requiring
capitalization of all letters.  Case matters.

On Thu, Mar 16, 2017 at 5:23 PM, Wesley Smith <wesley.h...@gmail.com> wrote:

> I'm trying to test out the C# features added to 3.8.0.  A few things:
>
> + I couldn't find any documentation as to what the language name for
> CSHARP was in the enable_language documentation page
>
> + When I tried enable_language(CSHARP), I got some errors
>
> CMake Error at CMakeLists.txt:4 (enable_language):
> No CMAKE_CSHARP_COMPILER could be found.
>
> In the error log, I see:
>
> The CSharp compiler identification could not be found in
> "/build_/CMakeFiles/3.8.0-rc2/CompilerIdCSharp/
> CompilerIdCSharp.csproj"
>
> When I open this project, it compiles and runs just fine.  I'm not sure
> why it's giving an error.  Any thoughts?
>
> thanks,
> wes
>
-- 

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-developers] Debugging issues with enable_language(CSHARP)

2017-03-22 Thread Wesley Smith
So the answer is enable_language(CSHARP) should be enable_language(CSharp).
-- 

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-developers

Re: [cmake-developers] Debugging issues with enable_language(CSHARP)

2017-03-22 Thread Wesley Smith
Thanks David,
I'll have a look at that.  Here's my CMake script

```
cmake_minimum_required(VERSION 3.8.0)
project(add-in)

enable_language(CSHARP)
```

On Wed, Mar 22, 2017 at 9:58 AM, David Cole <dlrd...@aol.com> wrote:

> Have you looked into
> https://github.com/Kitware/CMake/blob/master/Modules/
> CMakeDetermineCSharpCompiler.cmake
> ?
>
> Send steps to reproduce the problem you're seeing... Maybe somebody
> else here has encountered the same thing and worked through it
> already.
>
>
> HTH,
> David C.
>
>
>
> On Wed, Mar 22, 2017 at 12:33 PM, Wesley Smith <wesley.h...@gmail.com>
> wrote:
> > Hi,
> > I'm trying to diagnose why enable_language(CSHARP) isn't working for me
> in
> > the RC candidate. I've built CMake from source and am trying to step
> through
> > the code, but am coming up against the fact that this is an enormous
> project
> > and I don't quite know where to look.
> >
> > The new C# support is something I want to use on an upcoming project, so
> I'd
> > like to help solve any issues with it
> >
> > Here's where I'm at:
> >
> >
> > * I'm stepping through cmGlobalGenerator.xx in the EnableLanguage
> function.
> > When the only language is CSHARP, I'm erroring out where it attempts to
> get
> > the definition of CMAKE_SHARP_COMPILER
> >
> > * In CMakeErrr.log, I see:
> > The CSharp compiler identification could not be found in
> > "C:/Users/wes/Documents/GitHub/add-in/build_/CMakeFiles/3.8.20170317-
> g45851/CompilerIdCSharp/CompilerIdCSharp.csproj"
> >
> > When I compile and run this project by hand, I'm seeing
> >
> > InfoCompiler
> > "INFO:compiler[Microsoft Visual Studio]"
> > InfoPlatform
> > "INFO:platform[Windows]"
> > InfoArchitecture
> > "INFO:arch[x64]"
> > InfoCompilerVersion
> > "INFO:compiler_version[2017]"
> >
> > printed from this code:
> >
> > static void Main(string[] args)
> > {
> > // we have to print the lines to make sure
> > // the compiler does not optimize them away ...
> > System.Console.WriteLine(InfoCompiler);
> > System.Console.WriteLine(InfoPlatform);
> > System.Console.WriteLine(InfoArchitecture);
> > System.Console.WriteLine(InfoCompilerVersion);
> > }
> >
> >
> > It all looks good to me.  What I haven't been able to find is where the
> > project is compiled and run from within CMake and the console stdout
> read in
> > order to verify the C# compiler settings.
> >
> >
> > thanks,
> > wes
> >
> >
> > --
> >
> > 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-developers
>
-- 

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-developers

[CMake] C# Language Detection Errors in 3.8.0-rc2

2017-03-16 Thread Wesley Smith
I'm trying to test out the C# features added to 3.8.0.  A few things:

+ I couldn't find any documentation as to what the language name for CSHARP
was in the enable_language documentation page

+ When I tried enable_language(CSHARP), I got some errors

CMake Error at CMakeLists.txt:4 (enable_language):
No CMAKE_CSHARP_COMPILER could be found.

In the error log, I see:

The CSharp compiler identification could not be found in
"/build_/CMakeFiles/3.8.0-rc2/CompilerIdCSharp/CompilerIdCSharp.csproj"

When I open this project, it compiles and runs just fine.  I'm not sure why
it's giving an error.  Any thoughts?

thanks,
wes
-- 

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] FindCuda compiler flag problems

2015-05-11 Thread Wesley Smith
Hi,
I'm trying to compile w/ CUDA on Centos6 using Cuda7 and C++11.  When
I have host propagate flags on, the CXX flags get mangles with escapes
like this:

,\-fPIE\,\--std=c++11\,\-DGLM_FORCE_RADIANS\,\-g\


which causes a ton of errors.  If I turn host propagate flags off, I
then have to manually add --std=c++11 to the NVCC flags.  The problem
is that since I have CUDA_SEPARABLE_COMPILATION ON, the linker step
also gets --std=c++11, which is an error and compilation fails as a
result.  So, how do I resolve this?  Is there a way to have NVCC flags
only for compilation and not for linking?  Alternatively, is there a
way to avoid the crazy string escapes on the CXX flags passed to NVCC?


thanks,
wes
-- 

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] Cuda CUDA_SEPARABLE_COMPILATION errors during linking

2015-04-20 Thread Wesley Smith
Apparently there's a bug report and fix for this:
http://www.cmake.org/Bug/view.php?id=15016

But the fix hasn't been committed anywhere.  It has been lingering in
limbo for almost 9 months.
Thanks!!
wes

On Fri, Apr 17, 2015 at 4:20 PM, Wesley Smith wesley.h...@gmail.com wrote:
 With CUDA_SEPARABLE_COMPILATION enabled, I'm always getting linking
 errors when I try to build.  Seems it's looking for a directory that
 doesn't exist:
 'snip/build/CMakeFiles/SlicerLib.dir/Debug

 If I manually create this directory, everything works.  Seems that
 either the directory path isn't being computed properly or that code
 to create the directory if needed is missing.

 wes


 2C:\Program Files\NVIDIA GPU Computing
 Toolkit\CUDA\v7.0\bin\crt\link.stub : fatal error C1083: Cannot open
 compiler generated file:
 'snip/build/CMakeFiles/SlicerLib.dir/Debug/SlicerLib_intermediate_link.obj':
 No such file or directory
 2C:\Program Files
 (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
 error MSB3073: The command setlocal
 2C:\Program Files
 (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
 error MSB3073: C:\Program Files (x86)\CMake\bin\cmake.exe -E echo
 Building NVCC intermediate link file
 CMakeFiles/SlicerLib.dir/Debug/SlicerLib_intermediate_link.obj
 2C:\Program Files
 (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
 error MSB3073: if %errorlevel% neq 0 goto :cmEnd
 2C:\Program Files
 (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
 error MSB3073: C:\Program Files\NVIDIA GPU Computing
 Toolkit\CUDA\v7.0\bin\nvcc.exe -arch=sm_30 -m64 -ccbin C:\Program
 Files (x86)\Microsoft Visual Studio 12.0\VC\bin -Xcompiler /MDd
 -dlink 
 snip/build/CMakeFiles/SlicerLib.dir/src/bitmap/fragCounter/Debug/SlicerLib_generated_amFragCounterCuda.cu.obj
 snip/build/CMakeFiles/SlicerLib.dir/src/bitmap/materialCounter/Debug/SlicerLib_generated_amBitmapMaterialCounterABufferCuda.cu.obj
 snip/build/CMakeFiles/SlicerLib.dir/src/bitmap/materialCounter/Debug/SlicerLib_generated_amBitmapMaterialCounterCuda.cu.obj
 snip/build/CMakeFiles/SlicerLib.dir/src/cuda/Debug/SlicerLib_generated_amCuda.cu.obj
 snip/build/CMakeFiles/SlicerLib.dir/src/cuda/Debug/SlicerLib_generated_amCudaTexture.cu.obj
 snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorBoundaryProcess.cu.obj
 snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorContourDifference.cu.obj
 snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorContourOffset2.cu.obj
 snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorContourProcess.cu.obj
 snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorCudaHood.cu.obj
 snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorCudaIntersections.cu.obj
 snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorCudaLineSegments.cu.obj
 snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorCudaLineSegments2.cu.obj
 snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorCudaParametricIntersections.cu.obj
 snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorInfill45Processor.cu.obj
 snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorOutlineContour.cu.obj
 snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorSlicerProcess.cu.obj
 -o snip/build/CMakeFiles/SlicerLib.dir/Debug/SlicerLib_intermediate_link.obj
 2C:\Program Files
 (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
 error MSB3073: if %errorlevel% neq 0 goto :cmEnd
 2C:\Program Files
 (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
 error MSB3073: :cmEnd
 2C:\Program Files
 (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
 error MSB3073: endlocal  call :cmErrorLevel %errorlevel%  goto
 :cmDone
 2C:\Program Files
 (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
 error MSB3073: :cmErrorLevel
 2C:\Program Files
 (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
 error MSB3073: exit /b %1
 2C:\Program Files
 (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
 error MSB3073: :cmDone
 2C:\Program Files
 (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
 error MSB3073: if %errorlevel% neq 0 goto :VCEnd
 2C:\Program Files
 (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
 error MSB3073: :VCEnd exited with code 1.
 3-- Build started: Project: CmbVisualizer, Configuration: Debug x64 
 --
-- 

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

[CMake] Cuda7 issues

2015-04-17 Thread Wesley Smith
Hi,
I'm trying to use Cmake 3.2.2 to build with Cuda7 on Windows 8. I have
both Cuda 6.5 and Cuda 7.0 installed in these locations:

C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v6.5
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.0

When I try these:

find_package(CUDA 7.0 REQUIRED)
find_package(CUDA 7.0 REQUIRED)
find_package(CUDA 7 REQUIRED)


(just shooting in the dark here to see if something will work)

I always get the error

CMake Error at C:/Program Files
(x86)/CMake/share/cmake-3.2/Modules/FindPackageHandleStandardArgs.cmake:138
(message):
Could NOT find CUDA: Found unsuitable version 6.5, but required is at
least 7.0 (found C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v6.5)
Call Stack (most recent call first):
C:/Program Files
(x86)/CMake/share/cmake-3.2/Modules/FindPackageHandleStandardArgs.cmake:372
(_FPHSA_FAILURE_MESSAGE)
C:/Program Files
(x86)/CMake/share/cmake-3.2/Modules/FindCUDA.cmake:939
(find_package_handle_standard_args)
CMakeLists.txt:122 (find_package)


Any ideas?

thanks,
wes
-- 

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] Cuda CUDA_SEPARABLE_COMPILATION errors during linking

2015-04-17 Thread Wesley Smith
With CUDA_SEPARABLE_COMPILATION enabled, I'm always getting linking
errors when I try to build.  Seems it's looking for a directory that
doesn't exist:
'snip/build/CMakeFiles/SlicerLib.dir/Debug

If I manually create this directory, everything works.  Seems that
either the directory path isn't being computed properly or that code
to create the directory if needed is missing.

wes


2C:\Program Files\NVIDIA GPU Computing
Toolkit\CUDA\v7.0\bin\crt\link.stub : fatal error C1083: Cannot open
compiler generated file:
'snip/build/CMakeFiles/SlicerLib.dir/Debug/SlicerLib_intermediate_link.obj':
No such file or directory
2C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
error MSB3073: The command setlocal
2C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
error MSB3073: C:\Program Files (x86)\CMake\bin\cmake.exe -E echo
Building NVCC intermediate link file
CMakeFiles/SlicerLib.dir/Debug/SlicerLib_intermediate_link.obj
2C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
error MSB3073: if %errorlevel% neq 0 goto :cmEnd
2C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
error MSB3073: C:\Program Files\NVIDIA GPU Computing
Toolkit\CUDA\v7.0\bin\nvcc.exe -arch=sm_30 -m64 -ccbin C:\Program
Files (x86)\Microsoft Visual Studio 12.0\VC\bin -Xcompiler /MDd
-dlink 
snip/build/CMakeFiles/SlicerLib.dir/src/bitmap/fragCounter/Debug/SlicerLib_generated_amFragCounterCuda.cu.obj
snip/build/CMakeFiles/SlicerLib.dir/src/bitmap/materialCounter/Debug/SlicerLib_generated_amBitmapMaterialCounterABufferCuda.cu.obj
snip/build/CMakeFiles/SlicerLib.dir/src/bitmap/materialCounter/Debug/SlicerLib_generated_amBitmapMaterialCounterCuda.cu.obj
snip/build/CMakeFiles/SlicerLib.dir/src/cuda/Debug/SlicerLib_generated_amCuda.cu.obj
snip/build/CMakeFiles/SlicerLib.dir/src/cuda/Debug/SlicerLib_generated_amCudaTexture.cu.obj
snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorBoundaryProcess.cu.obj
snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorContourDifference.cu.obj
snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorContourOffset2.cu.obj
snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorContourProcess.cu.obj
snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorCudaHood.cu.obj
snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorCudaIntersections.cu.obj
snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorCudaLineSegments.cu.obj
snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorCudaLineSegments2.cu.obj
snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorCudaParametricIntersections.cu.obj
snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorInfill45Processor.cu.obj
snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorOutlineContour.cu.obj
snip/build/CMakeFiles/SlicerLib.dir/src/vector/Debug/SlicerLib_generated_amVectorSlicerProcess.cu.obj
-o snip/build/CMakeFiles/SlicerLib.dir/Debug/SlicerLib_intermediate_link.obj
2C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
error MSB3073: if %errorlevel% neq 0 goto :cmEnd
2C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
error MSB3073: :cmEnd
2C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
error MSB3073: endlocal  call :cmErrorLevel %errorlevel%  goto
:cmDone
2C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
error MSB3073: :cmErrorLevel
2C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
error MSB3073: exit /b %1
2C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
error MSB3073: :cmDone
2C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
error MSB3073: if %errorlevel% neq 0 goto :VCEnd
2C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(127,5):
error MSB3073: :VCEnd exited with code 1.
3-- Build started: Project: CmbVisualizer, Configuration: Debug x64 --
-- 

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 

Re: [CMake] Cuda7 issues

2015-04-17 Thread Wesley Smith
Ah, thanks!

On Fri, Apr 17, 2015 at 3:36 PM, James Bigler jamesbig...@gmail.com wrote:
 FindCUDA doesn't look for a specific version, but rather checks to see if
 the version it found is the one you asked for.  You can set the
 CUDA_TOOLKIT_ROOT_DIR to the one you want (and reconfigure - I've set it up
 to easily change this), or you can change your environment in Windows to
 point to the default version of CUDA you want (CUDA_PATH).

 It would be nice if it could search about and find an appropriate version.

 James

 On Fri, Apr 17, 2015 at 2:12 PM, Wesley Smith wesley.h...@gmail.com wrote:

 Hi,
 I'm trying to use Cmake 3.2.2 to build with Cuda7 on Windows 8. I have
 both Cuda 6.5 and Cuda 7.0 installed in these locations:

 C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v6.5
 C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.0

 When I try these:

 find_package(CUDA 7.0 REQUIRED)
 find_package(CUDA 7.0 REQUIRED)
 find_package(CUDA 7 REQUIRED)


 (just shooting in the dark here to see if something will work)

 I always get the error

 CMake Error at C:/Program Files

 (x86)/CMake/share/cmake-3.2/Modules/FindPackageHandleStandardArgs.cmake:138
 (message):
 Could NOT find CUDA: Found unsuitable version 6.5, but required is at
 least 7.0 (found C:/Program Files/NVIDIA GPU Computing
 Toolkit/CUDA/v6.5)
 Call Stack (most recent call first):
 C:/Program Files

 (x86)/CMake/share/cmake-3.2/Modules/FindPackageHandleStandardArgs.cmake:372
 (_FPHSA_FAILURE_MESSAGE)
 C:/Program Files
 (x86)/CMake/share/cmake-3.2/Modules/FindCUDA.cmake:939
 (find_package_handle_standard_args)
 CMakeLists.txt:122 (find_package)


 Any ideas?

 thanks,
 wes
 --

 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


-- 

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] copying dylibs into OSX bundle

2014-11-19 Thread Wesley Smith
Hi,
I've been searching for how to copy some dylib dependencies for quite
a while and can't seem to find a definitive answer on the problem.  I
have a .dylib file that needs to go into my app bundle (e.g.
MyApp.app/Frameworks).  From what I've read, to use the FIXUP_BUNDLE
command, the file already has to be copied inside the bundle.  How do
I do this?  I tried:

set(ASSIMP_DYLIB ${ASSIMP_LINK_PATH}/${ASSIMP_LIB_NAME}.dylib)
set_source_files_properties(${ASSIMP_DYLIB} PROPERTIES
MACOSX_PACKAGE_LOCATION Frameworks)
 add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${AM_SOURCES} ${ASSIMP_DYLIB})

but got errors

CMake Error at CMakeLists.txt:205 (add_executable):
Cannot find source file:

../support/libs/assimp/lib/osx/assimp.dylib

Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx


What's the proper way to copy here?

thanks,
wes
-- 

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