Re: [CMake] [VS] How to set static run-time for static lib release config?

2010-08-15 Thread Ryan Pavlik
 Great, thanks for sharing the update - looks good to me!  I never use 
the NMake makefiles generator, so I wouldn't have noticed that since 
it's a windows-only module.


Ryan

On 8/15/10 8:31 AM, Droscy wrote:

Hi Ryan, I've started using your MSVCStaticRuntime.cmake and everything
worked well until I tested it with "NMake Makefiles" generator, that
doesn't use CMAKE_CONFIGURATION_TYPES, so I edited your file to add the
content of CMAKE_BUILD_TYPE to the SUFFIXES of list_combinations in
order to make the replace works correctly.

Attached to this email the edited version.


Bye


Almost nobody uses the static runtime unless someone else's lib forces
them to, after which they will probably mutter under their breath.
With that disclaimer aside:

http://github.com/rpavlik/physical-modeling-utilities/blob/master/cmake/MSVCStaticRuntime.cmake





--
Ryan Pavlik
Human-Computer Interaction Graduate Student
Virtual Reality Applications Center
Iowa State University

rpav...@iastate.edu
http://academic.cleardefinition.com/

___
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] [VS] How to set static run-time for static lib release config?

2010-08-15 Thread Droscy
Hi Ryan, I've started using your MSVCStaticRuntime.cmake and everything
worked well until I tested it with "NMake Makefiles" generator, that
doesn't use CMAKE_CONFIGURATION_TYPES, so I edited your file to add the
content of CMAKE_BUILD_TYPE to the SUFFIXES of list_combinations in
order to make the replace works correctly.

Attached to this email the edited version.


Bye

> Almost nobody uses the static runtime unless someone else's lib forces
> them to, after which they will probably mutter under their breath. 
> With that disclaimer aside:
>
> http://github.com/rpavlik/physical-modeling-utilities/blob/master/cmake/MSVCStaticRuntime.cmake
>
>
# - Modify compile flags to use the static runtimes of MSVC
#
#  include(MSVCStaticRuntime)
#
# Requires these CMake modules:
#  ListCombinations.cmake
#
# Original Author:
# 2009-2010 Ryan Pavlik  
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC

if(MSVC)
	string(TOUPPER "${CMAKE_CONFIGURATION_TYPES}" _conftypesUC)
	string(TOUPPER "${CMAKE_BUILD_TYPE}" _buildtypeUC)
	
	include(ListCombinations)
	list_combinations(_flags
		PREFIXES
			CMAKE_C_FLAGS_
			CMAKE_CXX_FLAGS_
		SUFFIXES
			${_conftypesUC}
			${_buildtypeUC})
			
	foreach(_var ${_flags} CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
		string(REPLACE "/MD" "/MT" ${_var} "${${_var}}")
	endforeach()
endif()

set(Boost_USE_STATIC_LIBS ON)
___
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] [VS] How to set static run-time for static lib release config?

2010-07-30 Thread Olaf van der Spek
On Fri, Jul 30, 2010 at 2:11 PM, Ryan Pavlik  wrote:
>  On 7/30/10 7:01 AM, Olaf van der Spek wrote:
>>
>> On Fri, Jul 30, 2010 at 1:52 PM, Ryan Pavlik  wrote:
>>>
>>> Almost nobody uses the static runtime unless someone else's lib forces
>>> them
>>
>> Why not?
>> If Windows had proper package management I wouldn't use it either, but
>> until then...
>>
>> Olaf
>
> I'd only really just offer it as one option, in case a user of your library
> is forced to use another library with the static runtime.  It doesn't mean
> that you don't have a static library without it, it just means you aren't
> embedding the entire standard c/c++ runtime library into yours, bloating
> memory usage, and inviting lots of symbol collisions when versions don't
> quite match.  Myself and my colleagues have collectively lost significant
> hair on this one, and it took a while for me to figure out exactly what it
> all meant since it's kind of confusing. (and the error messages more so)

That's why I'm asking for library names to be decorated!
So one can choose and know whether a library is using the run-time in
a static way or in a dynamic way.

Olaf
___
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] [VS] How to set static run-time for static lib release config?

2010-07-30 Thread Ryan Pavlik

 On 7/30/10 7:01 AM, Olaf van der Spek wrote:

On Fri, Jul 30, 2010 at 1:52 PM, Ryan Pavlik  wrote:

Almost nobody uses the static runtime unless someone else's lib forces them

Why not?
If Windows had proper package management I wouldn't use it either, but
until then...

Olaf
I'd only really just offer it as one option, in case a user of your 
library is forced to use another library with the static runtime.  It 
doesn't mean that you don't have a static library without it, it just 
means you aren't embedding the entire standard c/c++ runtime library 
into yours, bloating memory usage, and inviting lots of symbol 
collisions when versions don't quite match.  Myself and my colleagues 
have collectively lost significant hair on this one, and it took a while 
for me to figure out exactly what it all meant since it's kind of 
confusing. (and the error messages more so)


For more info:
http://msdn.microsoft.com/en-us/library/abx4dbyh%28VS.80%29.aspx

http://www.rationaldev.com/error_LNK2005_method_already_defined_in_LIBCMT_lib

http://support.microsoft.com/kb/94248 - see section 4 and 5

Ryan

--
Ryan Pavlik
Human-Computer Interaction Graduate Student
Virtual Reality Applications Center
Iowa State University

rpav...@iastate.edu
http://academic.cleardefinition.com/

___
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] [VS] How to set static run-time for static lib release config?

2010-07-30 Thread Olaf van der Spek
On Fri, Jul 30, 2010 at 1:52 PM, Ryan Pavlik  wrote:
> Almost nobody uses the static runtime unless someone else's lib forces them

Why not?
If Windows had proper package management I wouldn't use it either, but
until then...

Olaf
___
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] [VS] How to set static run-time for static lib release config?

2010-07-30 Thread Ryan Pavlik

 On 7/30/10 5:25 AM, Olaf van der Spek wrote:

Hi,

CMake creates a VS project file that uses the dynamic run-time for
static libs. This is not what I want in release builds.
How do I change this?

Greetings,

Olaf

cmake_minimum_required(VERSION 2.4)
set(CMAKE_BUILD_TYPE release)
include_directories(.)
add_library(
xbt
sql/database.cpp
sql/sql_query.cpp
sql/sql_result.cpp
)
install(TARGETS xbt DESTINATION lib)


Almost nobody uses the static runtime unless someone else's lib forces 
them to, after which they will probably mutter under their breath.  With 
that disclaimer aside:


http://github.com/rpavlik/physical-modeling-utilities/blob/master/cmake/MSVCStaticRuntime.cmake

--
Ryan Pavlik
Human-Computer Interaction Graduate Student
Virtual Reality Applications Center
Iowa State University

rpav...@iastate.edu
http://academic.cleardefinition.com/

___
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] [VS] How to set static run-time for static lib release config?

2010-07-30 Thread Olaf van der Spek
Hi,

CMake creates a VS project file that uses the dynamic run-time for
static libs. This is not what I want in release builds.
How do I change this?

Greetings,

Olaf

cmake_minimum_required(VERSION 2.4)
set(CMAKE_BUILD_TYPE release)
include_directories(.)
add_library(
xbt
sql/database.cpp
sql/sql_query.cpp
sql/sql_result.cpp
)
install(TARGETS xbt DESTINATION lib)
___
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