Re: [CMake] Problem with Visual Studio 2010, Windows 7 64bit

2012-11-28 Thread Titus von Boxberg

Am 28.11.2012 13:59, schrieb Michael Jackson:


On Nov 28, 2012, at 7:37 AM, David Doria daviddo...@gmail.com wrote:


On Wed, Nov 28, 2012 at 4:22 AM, Andrew Maclean
andrew.amacl...@gmail.com wrote:

Interesting ... I have no problems, the only thing I can think of is that I
had VS 2010 SP1 installed before I installed VS 2012 Express, I did not use
any of the RC versions.


Petr,

A colleague mentioned that with the same setup he was getting the same
error, and then installed SP1 for VS 2010 and things started working.
It would really be great if there were better checks/errors because it
is really a huge barrier for projects like VTK to get users to fight
through install problems. Hey you should use VTK for that works when
they have to follow a few instructions and it works, but when they
have to spend days working through cryptic errors most tend to give up
and then we lose a user.

Andrew,

I'm almost certain that it will never work using the VS generators
(with very different can't find the compiler type of errors) unless
you run cmake-gui from a terminal unless you have manually added many
VS things to the system environment variables. At least that has been
my experience on many machines.

David
--



Here is my theory on mixing visual studios. When you install Visual Studio 
Windows will dutifully add the Visual Studio tools to the PATH for everyone. 
This is why you can just launch CMakeGui and have the Visual Studio generators 
work correctly. All is well. This is where I ran into problems.. Now install 
Visual Studio 2012 (or any other version) alonside VS2010 and Windows will 
again the 2012 to the PATH also. Now you have BOTH VS version's tools in the 
path but what ever is found FIRST is the one that is going to be used which 
will cause problems when launching CMakeGUi from Windows Explorer. At least 
this is what I saw years ago and why I NEVER mix versions. I install each 
version into its own Virtual Machine and run that way. It avoids all of these 
PATH issues.
Unless CMake has some code to look into the registry to fully determine 
which compiler you want and setup the environment correctly by removing PATHS 
from a version of Visual Studio that you are NOT using I don't see how having 
more than a single Visual studio installed is going to work***


I doubt your theory ;-)
VS installer does not insert VS tools into the PATH.
That's one reason why you have the vsvars-batch files to set up the
environment.

Another source of my doubt is that I also can confirm that the problems
with VS 2010 vanished after installing VS2010 SP1.

Regards
Titus

--

Powered by www.kitware.com

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

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

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


Re: [CMake] How to get Visual Studio to use more than a single core for compiling

2012-11-26 Thread Titus von Boxberg

Am 27.11.2012 05:24, schrieb Michael Jackson:

That will teach me to hit enter in GMail..

My question is this: What is the magic CMake incantation to get Visual
Studio 2010 to use more than a single processor when compiling my
project?

You could add /MP to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS

Regards
Titus
--

Powered by www.kitware.com

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

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

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


Re: [CMake] CMake project building other CMake projects

2012-10-19 Thread Titus von Boxberg

Hi,

I just switched from ExternalProject to add_subdirectory.
The reason for me to switch was
(just discussed a few days ago on this list)
that with ExternalProject there is no automatic way
to get nice IDE project files.
My reason to use ExternalProject was that I didn't understand
that I could use add_subdirectory at the time when I switched to CMake.

It seems to me that add_subdirectory is provided for the case that
all sources are managed in common where ExternalProject really
is designed for the case the command is named after.

All of my sources (whether main project or added subdir)
use the same settings, so I have only few variables that
I have to reset when using add_subdirectory; so I don't know
how much effort that would be for you.

For the ExternalProject way I used -D for the external configure
step to transport configuration variables (actually, just one)
to the subprojects.

HTH
Regards
Titus

When using ExternalProject
Am 19.10.2012 15:40, schrieb Tim Gallagher:

Hi,

I'm working on getting our CMake project to build the other libraries we wrote 
and I'm not sure how it needs to be done. Our main code is a git repository and 
inside the repo is a lib/ directory with git submodules for our other libraries.

What is the best way to get the main project to build these submodules? It seems like I 
could use ExternalProject to do it, even though I don't need to download/checkout 
anything, but it also looks like I could just add_subdirectory(lib/myLibrary) also. Which 
is the best practice?

If I go the add_subdirectory route, do I need to namespace my variables 
somehow? For instance, all of our projects use CMAKE_INSTALL_PREFIX to indicate 
the installation directory, but if I were to build them all at once, they need 
to be installed different places, so will the names clash? Do I need to change 
all the variables in each library to be myLibrary_*?

If I use ExternalProject, do I have to then manually add the options to my main 
project's CMakeLists so the user can configure them and then pass them through 
to the submodule's configure step with -D...?

Is there something else I'm missing in how to do this? It seems like projects 
we maintain and can include as git submodules could/should be built differently 
than projects like Python that we don't include as submodules. But our own 
projects also provide a *Config.cmake, so maybe they could be treated the 
same...

Tim

Tim
--

Powered by www.kitware.com

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

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

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


--

Powered by www.kitware.com

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

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

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


[CMake] include, macro and project

2012-10-17 Thread Titus von Boxberg

Hi all,

maybe it's a silly question, but RTFM doesn't enlighten me yet:

I'd like to set the project() in a macro() defined in a file included
by CMakeLists.txt.
The macro get's called immediately after including() the file
from within CMakeLists.txt

When calling the macro cmake executes the steps in an execution order
different from the case when I directly call project() instead
of using the macro:
When using the macro, CMake first checks for the compilers, etc.
and then executes the include file.
When using project() directly, CMake first executes the include file
and then checks the compilers, etc.

The include file is determining the tool chain depending on
some configuration variables, that's why this is a problem for me.
Even if the use case might be questionnable, still I'd like to
understand the reason for the difference.

Attached is a minimal sample to reproduce the behaviour.

Any explanation?

Thanks and Regards
Titus
MESSAGE(STATUS Executing global scope of CMake-Include file)

MACRO(testmacro proj)
MESSAGE(STATUS Executing macro of CMake-Include file)
project(${proj})
ENDMACRO()
 CMakeFiles.txt

cmake_minimum_required(VERSION 2.8)

include(CMake-Include.txt)

# Calling testmacro results in execution of CMake-Include.txt
# after checking for the compilers.
# testmacro(macroproject)

# setting project directly results in immediate execution
# of CMake-Include.txt
project(testproject)
--

Powered by www.kitware.com

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

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

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

Re: [CMake] ExternalProjects with Visual Studio

2012-10-17 Thread Titus von Boxberg

Am 16.10.2012 19:47, schrieb David Cole:

If you want real vcxproj references, then use add_subdirectory
instead of ExternalProject to build things directly.

Or is there some reason you can't do that?

Apparently not, and this seems to be the Right Idea.
It's just that I wouldn't have thought of this possibility from the
documentation of add_subdirectory when I first read it.

Thanks and Regards!
Titus
--

Powered by www.kitware.com

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

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

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


Re: [CMake] Adding dependencies for static libraries

2012-10-16 Thread Titus von Boxberg

Am 16.10.2012 12:43, schrieb Robert Bielik:

Hi all, I haven't found the answer to this: I have a static library A
that uses static library B, but when I create an executable C I only
want to link with A.

AFAIK you have to link C also with B.
You might add a target_link_libraries(C B) in C's configuration.

A non portable way to avoid this configuration could be to
use automatic linking directives in A's headers included by C.



In Visual Studio this is accomplished by adding library B to Additional
Dependencies (Librarian/General), but how can I make CMake create that
dependency ?

When you add B to the Additional Dependencies, C is linked with B.

Actually, target_link_libraries(C B) puts B into the
Additional Dependencies of the VC project generated for C.

HTH
Titus

--

Powered by www.kitware.com

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

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

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


Re: [CMake] Adding dependencies for static libraries

2012-10-16 Thread Titus von Boxberg

Am 16.10.2012 17:53, schrieb Robert Bielik:

Titus von Boxberg skrev 2012-10-16 13:20:

Actually, target_link_libraries(C B) puts B into the
Additional Dependencies of the VC project generated for C.


Unfortunately that doesn't cut it. target_link_libraries adds the build
dependency, but it does not list the lib files in Additional
Dependecies, which I think shuld be default behavior with static
libraries (just as it does for a shared library).

Well, I'm using target_link_libraries and it does what I described:
Add the libraries to Additional Dependencies of the EXE project.



I'll file a bug report for this. My whole aim is to be able to create a
single static library file that contains everything it needs, so that an
executable linking statically won't have to bother. Using a shared
library is an option, but we'd like to be able to offer customers both
dynamic and static linking options.

That wasn't clear from your first post.
I doubt that this is the intended behaviour of target_link_libraries.
If you want the librarian to combine A and B into a single A+
than you might as well add a post build step of A to do so.

Regards
Titus
--

Powered by www.kitware.com

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

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

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


[CMake] ExternalProjects with Visual Studio

2012-10-15 Thread Titus von Boxberg

Hi all,

my C++ sources are split into several (static) libraries and
an executable that uses the static libs.
All of those source modules have CMake configurations.

I'm using ExternalProject_Add in the executable's CMakeLists.txt
together with target_link_libraries
to add the static libs to the executable's project.

All that works well under UNIX and Windows.

However, when opening the sln with Visual Studio, the project files
of the libraries do not contain the sources; they are only placeholders
to build the libraries for the executable.
That's clear to me since the real vcxproj files within the
libraries are generated during the configure step of the
ExternalProject build and are unavailable at the time the
executable's sln or vcxproj are generated by cmake.

My question is: Is there an automatic way to get sln and vcxproj
files for the executable that reference the real vcxproj files
of the libraries instead of the placeholders?

Thanks in advance

Regards
Titus
--

Powered by www.kitware.com

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

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

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