Re: [CMake] How to query compiler definitions?

2011-01-20 Thread SF Markus Elfring

get_directory_property(info COMPILE_DEFINITIONS)


How do you think about an extension for this programming interface?

Would you like to support that target parameters like preprocessor symbols are 
queried from the build environment even if they were not set by the CMake 
command add_definitions explicitly?


Regards,
Markus
___
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 query compiler definitions?

2011-01-20 Thread Michael Wild
On 01/20/2011 01:30 PM, SF Markus Elfring wrote:
 get_directory_property(info COMPILE_DEFINITIONS)
 
 How do you think about an extension for this programming interface?
 
 Would you like to support that target parameters like preprocessor
 symbols are queried from the build environment even if they were not set
 by the CMake command add_definitions explicitly?
 
 Regards,
 Markus

Probably that would be pretty difficult to achieve and definitely would
break backwards-compatibility beyond resurrection.

OTOH, I really think that you're on the wrong track here. You shouldn't
check for a preprocessor symbol in CMake. Instead, probably do a
find_package(TinyXML) and then depending on the result offer the user an
option variable (e.g. ENABLE_DEBUGGING_FUNCTIONS), define a preprocessor
symbol HAVE_TINYXML which you then use in your code together with NDEBUG
to determine whether to

- don't call the debugging functions at all (NDEBUG defined)
- either provide dummy/stub debugging functions or #error out (NDEBUG
and HAVE_TINYXML not defined)
- call the debugging functions (NDEBUG not defined, HAVE_TINYXML defined)

This would put the load on the users shoulders, but it should be pretty
clear for him what is expected and how to handle things. The INSTALL
document can also help there.

Michael
___
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 query compiler definitions?

2011-01-20 Thread SF Markus Elfring

Probably that would be pretty difficult to achieve and definitely would
break backwards-compatibility beyond resurrection.


I have got a different opinion. I imagine that a property with a new name can 
provide the desired service to retrieve target parameters in a portable way from 
the build environment.

Otherwise: Would the addition of a CMake command make more sense for this 
purpose?



You shouldn't check for a preprocessor symbol in CMake.


It's just the way I would prefer to adapt the build process to the requirements 
of the source files at the moment.


It seems that the evaluation of compilation parameters (variable 
CMAKE_CXX_FLAGS...) with regular expressions is an approach that will 
currently work to some degree. The used pattern determines how many compilers 
will be supported.




Instead, probably do a find_package(TinyXML)


I would appreciate if a corresponding module (search script) will become 
generally available for CMake.




and then depending on the result offer the user an option variable


I guess that the term user needs to be distinguished for its various meanings.

There are some switches involved that might only interest a subset of them.
- software developers
- system integrators
- tool users

Regards,
Markus
___
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 query compiler definitions?

2011-01-20 Thread Michael Wild
On 01/20/2011 04:30 PM, SF Markus Elfring wrote:
 Probably that would be pretty difficult to achieve and definitely would
 break backwards-compatibility beyond resurrection.
 
 I have got a different opinion. I imagine that a property with a new
 name can provide the desired service to retrieve target parameters in a
 portable way from the build environment.
 Otherwise: Would the addition of a CMake command make more sense for
 this purpose?

A single property wouldn't do, you would need one for every
configuration and the general configuration, e.g.

- ALL_COMPILE_DEFINITIONS
- ALL_COMPILE_DEFINITIONS_DEBUG
- ALL_COMPILE_DEFINITIONS_RELEASE
- ALL_COMPILE_DEFINITIONS_MINSIZEREL
- ALL_COMPILE_DEFINITIONS_RELWITHDEBUGINFO
- plus other, user-defined configurations

These properties would need to read-only and available for directories,
source files and targets. That's a lot of work, but if it scratches your
itch, go ahead, get hackin' ;-)

 
 
 You shouldn't check for a preprocessor symbol in CMake.
 
 It's just the way I would prefer to adapt the build process to the
 requirements of the source files at the moment.
 
 It seems that the evaluation of compilation parameters (variable
 CMAKE_CXX_FLAGS...) with regular expressions is an approach that will
 currently work to some degree. The used pattern determines how many
 compilers will be supported.
 

I don't think that the string NDEBUG is so common, so you could just
check for that and don't worry about the specific compiler flag.

 
 Instead, probably do a find_package(TinyXML)
 
 I would appreciate if a corresponding module (search script) will become
 generally available for CMake.

You could write one ;-) You could also include a private version of
that script in your project and then append its location to the
CMAKE_MODULE_PATH variable.

 
 
 and then depending on the result offer the user an option variable
 
 I guess that the term user needs to be distinguished for its various
 meanings.
 
 There are some switches involved that might only interest a subset of them.
 - software developers
 - system integrators
 - tool users
 

User here means the dude who downloaded your package from SF and tries
to build it on his machine. :-) To hide uninteresting switches, you can
use the mark_as_advanced() command.

Michael

___
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 query compiler definitions?

2011-01-20 Thread Eric Noulard
2011/1/20 SF Markus Elfring elfr...@users.sourceforge.net:
 Probably that would be pretty difficult to achieve and definitely would
 break backwards-compatibility beyond resurrection.

 I have got a different opinion. I imagine that a property with a new name
 can provide the desired service to retrieve target parameters in a portable
 way from the build environment.
 Otherwise: Would the addition of a CMake command make more sense for this
 purpose?


 You shouldn't check for a preprocessor symbol in CMake.

 It's just the way I would prefer to adapt the build process to the
 requirements of the source files at the moment.

 It seems that the evaluation of compilation parameters (variable
 CMAKE_CXX_FLAGS...) with regular expressions is an approach that will
 currently work to some degree. The used pattern determines how many
 compilers will be supported.


 Instead, probably do a find_package(TinyXML)

 I would appreciate if a corresponding module (search script) will become
 generally available for CMake.


 and then depending on the result offer the user an option variable

 I guess that the term user needs to be distinguished for its various
 meanings.

 There are some switches involved that might only interest a subset of them.

When you have such different levels of option you may do something like:

OPTION(DEVELOPER_OPT_ENABLE  Enable developer options OFF)
OPTION(SYSTEM_INTEGRATOR_OPT_ENABLE  Enable system integrator
specific options OFF)
OPTION(TOOL_USERS_OPT_ENABLE  Enable tool users options ON)

 - software developers
 - system integrators
 - tool users

then you do

IF (DEVELOPER_OPT_ENABLE)
OPTION(DEV_OPT1 blah blah ON)
OPTION(DEV_OPT2 blah blah OFF)
ENDIF(DEVELOPER_OPT_ENABLE)

IF (TOOL_USERS_OPT_ENABLE)
OPTION(USR_OPT1 blah blah ON)
OPTION(USR_OPT2 blah blah OFF)
OPTION(USR_OPT3 blah blah ON)
ENDIF(TOOL_USERS_OPT_ENABLE)

so an option may perfectly depend on another option, such kind of config
may need several configure steps but its works well (at least for me).

With sensible default option value average user will get its appropriate option
in CMake GUI whereas developers knows how to get more.



-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
___
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 query compiler definitions?

2011-01-20 Thread Rolf Eike Beer
 When you have such different levels of option you may do something like:

 OPTION(DEVELOPER_OPT_ENABLE  Enable developer options OFF)
 OPTION(SYSTEM_INTEGRATOR_OPT_ENABLE  Enable system integrator
 specific options OFF)
 OPTION(TOOL_USERS_OPT_ENABLE  Enable tool users options ON)

 - software developers
 - system integrators
 - tool users

 then you do

 IF (DEVELOPER_OPT_ENABLE)
 OPTION(DEV_OPT1 blah blah ON)
 OPTION(DEV_OPT2 blah blah OFF)
 ENDIF(DEVELOPER_OPT_ENABLE)

 IF (TOOL_USERS_OPT_ENABLE)
 OPTION(USR_OPT1 blah blah ON)
 OPTION(USR_OPT2 blah blah OFF)
 OPTION(USR_OPT3 blah blah ON)
 ENDIF(TOOL_USERS_OPT_ENABLE)

 so an option may perfectly depend on another option, such kind of config
 may need several configure steps but its works well (at least for me).

Sounds like you are searching for CMakeDependentOption. Search again in
the man page an you will find it ;)

Eike
___
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 query compiler definitions?

2011-01-20 Thread Eric Noulard
2011/1/20 Rolf Eike Beer e...@sf-mail.de:
 When you have such different levels of option you may do something like:

 OPTION(DEVELOPER_OPT_ENABLE  Enable developer options OFF)
 OPTION(SYSTEM_INTEGRATOR_OPT_ENABLE  Enable system integrator
 specific options OFF)
 OPTION(TOOL_USERS_OPT_ENABLE  Enable tool users options ON)

 - software developers
 - system integrators
 - tool users

 then you do

 IF (DEVELOPER_OPT_ENABLE)
     OPTION(DEV_OPT1 blah blah ON)
     OPTION(DEV_OPT2 blah blah OFF)
 ENDIF(DEVELOPER_OPT_ENABLE)

 IF (TOOL_USERS_OPT_ENABLE)
     OPTION(USR_OPT1 blah blah ON)
     OPTION(USR_OPT2 blah blah OFF)
     OPTION(USR_OPT3 blah blah ON)
 ENDIF(TOOL_USERS_OPT_ENABLE)

 so an option may perfectly depend on another option, such kind of config
 may need several configure steps but its works well (at least for me).

 Sounds like you are searching for CMakeDependentOption. Search again in
 the man page an you will find it ;)

Thank you Rolf
I didn't realized it already exists and never dare looking for it
since I was doint this by hand :-]

Will use it next time.



-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
___
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 query compiler definitions?

2011-01-19 Thread Michael Wild
On 01/19/2011 09:30 AM, SF Markus Elfring wrote:
 Hello,
 
 I know that some source code will only be needed in my example project
 if the preprocessor symbol NDEBUG is not defined.
 This is usual for conditional compilation. The corresponding bit of
 debug code calls functions which are implemented in a few other source
 files.
 Now I am looking for ways whether these files can be added on demand to
 the build process.
 
 I try to query the settings by a programming interface from CMake 2.8.3
 on my openSUSE 11.3 system.
 
 get_directory_property(info COMPILE_DEFINITIONS)
 message(STATUS info: ${info})
 
 The corresponding display indicates that this variable is empty. I guess
 that this fact should be interpreted also in the way that the specified
 property is not defined in my situation.
 Now I wonder why this approach does not work as expected. (A few
 definitions are passed to my compiler of course.)
 
 I would appreciate your advices.
 
 Regards,
 Markus


The NDEBUG flag is special and gets set by CMake for non-debug builds
automagically. Also, such an approach as you propose would work for
Makefile generators, but would completely fail for multi-config IDE
generators, such as Xcode or VisualStudio. Why don't you include the
check for NDEBUG in in your debug-sources? Like this:

debug-functions.c:
--8--
#ifndef NDEBUG
void some_debug_function(void)
{
  /* whathever */
}
#endif
--8--

The time you'll waste compiling these files will be negligible, and it
would work with mult-config IDE's.

Michael
___
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 query compiler definitions?

2011-01-19 Thread SF Markus Elfring

Why don't you include the check for NDEBUG in in your debug-sources?


This is the case already.



The time you'll waste compiling these files will be negligible, and it
would work with mult-config IDE's.


I find this view debatable. I would appreciate if I can express in the build 
specification that a few source file are optional for the compilation because of 
this well-known preprocessor symbol.


Regards,
Markus
___
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 query compiler definitions?

2011-01-19 Thread Michael Wild
On 01/19/2011 09:50 AM, SF Markus Elfring wrote:
 Why don't you include the check for NDEBUG in in your debug-sources?
 
 This is the case already.
 
 
 The time you'll waste compiling these files will be negligible, and it
 would work with mult-config IDE's.
 
 I find this view debatable. I would appreciate if I can express in the
 build specification that a few source file are optional for the
 compilation because of this well-known preprocessor symbol.
 
 Regards,
 Markus

But that's exactly the problem. For multi-config IDE's you *don't know*
whether NDEBUG is defined or not at CMake-time. And AFAIK there's no way
to specify that a source file is conditional on the build configuration.

The only other way I can see how to handle this, is to create a static
library (say debug_funcs) and then link that conditionally. E.g:

--8--
add_library(debug_funcs STATIC EXCLUDE_FROM_ALL debug_funcs.c)
add_executable(super super.c)
target_link_libraries(super debug debug_funcs)
--8--

This way, as I understand it, debug_funcs will only be built if the
executable super links against it, which it only does for the Debug
configuration.

Michael
___
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 query compiler definitions?

2011-01-19 Thread SF Markus Elfring

For multi-config IDE's you *don't know* whether NDEBUG is defined or not at 
CMake-time.


I imagine that the build system could keep control on all passed compilation 
parameters if calls for generation commands would be intercepted (by CMake).

Does it get any feedback for changes of this preprocessor symbol?



And AFAIK there's no way to specify that a source file is conditional on the 
build configuration.


I can try an approximation. - Do I need to apply the variable CMAKE_BUILD_TYPE 
instead if I can not reuse the symbol's value?




add_executable(super super.c)


I would like to construct the source file list that is passed to this command 
dynamically. Can unneeded stuff be avoided?


Regards,
Markus
___
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 query compiler definitions?

2011-01-19 Thread Michael Wild

Just tried out my last approach, and found out that it doesn't work. The
executable target always depends on the library target, irrespective of
the build configuration.

On 01/19/2011 11:50 AM, SF Markus Elfring wrote:
 For multi-config IDE's you *don't know* whether NDEBUG is defined or
 not at CMake-time.
 
 I imagine that the build system could keep control on all passed
 compilation parameters if calls for generation commands would be
 intercepted (by CMake).
 Does it get any feedback for changes of this preprocessor symbol?

You don't seem to understand the difference between CMake-time and Make-
(or build-) time.

CMake-time is when you run CMake to generate the actual build system
(Makefiles, Xcode project, VisualStudio project, etc.). This is when
your CMake code runs, when you have to specify all the source files etc.

Build-time is when the actual build system runs. Everything is static
here (except for custom commands). In particular, you can't change the
list of source files any more.

 
 
 And AFAIK there's no way to specify that a source file is conditional
 on the build configuration.
 
 I can try an approximation. - Do I need to apply the variable
 CMAKE_BUILD_TYPE instead if I can not reuse the symbol's value?
 

Again, that variable is useless for multi-config generators as it is
only meaningful for Makefile and other single-config generators.

 
 add_executable(super super.c)
 
 I would like to construct the source file list that is passed to this
 command dynamically. Can unneeded stuff be avoided?

The problem is, you want to assemble that list at build-time, which is
not possible, because then CMake wouldn't know about them.

 
 Regards,
 Markus


I don't quite understand why it is so important to you that these files
aren't passed to the compiler. If you exclude all of their contents with
#ifndef NDEBUG, then each file should take less than a second to
compile, so you'd need a lot of those debug-only files for it to matter.

Michael
___
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 query compiler definitions?

2011-01-19 Thread SF Markus Elfring

You don't seem to understand the difference between CMake-time and Make-
(or build-) time.


I understand that there can be differences between the time of configuration and 
the applied generation. I guess that we have got different expectations about 
the introspection capabilities of the CMake build system.




Build-time is when the actual build system runs.
Everything is static here (except for custom commands).


I do not want it this way for my use case.



In particular, you can't change the list of source files any more.


I imagine that the build system can still accommodate to some changes from other 
sources like preprocessor symbols.




The problem is, you want to assemble that list at build-time, which is
not possible, because then CMake wouldn't know about them.


Can instructions from CMake scripts also be executed at generation time?



I don't quite understand why it is so important to you that these files
aren't passed to the compiler. If you exclude all of their contents with
#ifndef NDEBUG, then each file should take less than a second to
compile, so you'd need a lot of those debug-only files for it to matter.


I hope that a more detailed description will clarify my use case.

Example:
A source file toy.cxx contains already the preprocessor switch that you 
mentioned. The marked debug code works with objects from a C++ class library for 
XML processing which has got its bunch of source files bundled in this project. 
Now I would like to omit this dependency if the software will be built for 
release mode. I would also like to be sure and want to check before the call 
of a compiler if this special symbol is really set.


Regards,
Markus
___
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 query compiler definitions?

2011-01-19 Thread Michael Wild
On 01/19/2011 02:41 PM, SF Markus Elfring wrote:
 You don't seem to understand the difference between CMake-time and Make-
 (or build-) time.
 
 I understand that there can be differences between the time of
 configuration and the applied generation. I guess that we have got
 different expectations about the introspection capabilities of the CMake
 build system.
 
 
 Build-time is when the actual build system runs.
 Everything is static here (except for custom commands).
 
 I do not want it this way for my use case.

Then CMake is not the right tool for you ;-) This would require the
configure+generation step to occur at the same time as the build step.

 
 
 In particular, you can't change the list of source files any more.
 
 I imagine that the build system can still accommodate to some changes
 from other sources like preprocessor symbols.

You could ask for a source-file property to that effect. E.g.

set_source_files_properties(debug_funcs.c PROPERTIES
  EXCLUDE_FROM_CONFIGURATIONS Release;MinSizeRel)

which would cause debug_funcs.c only to be compiled for the not-excluded
configurations. I don't think it would make to do this based on
preprocessor definitions.

 
 
 The problem is, you want to assemble that list at build-time, which is
 not possible, because then CMake wouldn't know about them.
 
 Can instructions from CMake scripts also be executed at generation time?

Only scripts that are run through add_custom_command or
add_custom_target, but they are really isolated scripts (think bash or
python), they don't have any feedback on the build system.

 
 
 I don't quite understand why it is so important to you that these files
 aren't passed to the compiler. If you exclude all of their contents with
 #ifndef NDEBUG, then each file should take less than a second to
 compile, so you'd need a lot of those debug-only files for it to matter.
 
 I hope that a more detailed description will clarify my use case.
 
 Example:
 A source file toy.cxx contains already the preprocessor switch that
 you mentioned. The marked debug code works with objects from a C++ class
 library for XML processing which has got its bunch of source files
 bundled in this project. Now I would like to omit this dependency if the
 software will be built for release mode. I would also like to be sure
 and want to check before the call of a compiler if this special symbol
 is really set.
 
 Regards,
 Markus

So, toy.cxx is not actually the problem, but you don't want to link
against the XML library. Do you need the library anyways (e.g. for other
targets) or does the whole project only require this library for this
debugging code? The question is, would something like this do for you
(here I assume the library you need is libxml)?

---8

find_package(FindLibXml2 REQUIRED)
include_directories(${LIBXML2_INCLUDE_DIR})
if(LIBXML2_DEFINITIONS)
  add_definitions(${LIBXML2_DEFINITIONS})
endif()

add_executable(super a.cxx b.cxx c.cxx toy.cxx)
target_link_libraries(super foo bar debug ${LIBXML2_LIBRARIES})

add_executable(duper d.cxx e.cxx)
target_link_libraries(duper ${LIBXML2_LIBRARIES})

---8

Like this you only link the target super against the libxml libraries
for debug configurations. Since target duper always needs libxml, it's
ok to require it always.

However, if libxml is required for debugging only and you don't want to
require it unconditionally, you have a problem and I can't see an easy
way around it.
___
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 query compiler definitions?

2011-01-19 Thread SF Markus Elfring

set_source_files_properties(debug_funcs.c PROPERTIES
   EXCLUDE_FROM_CONFIGURATIONS Release;MinSizeRel)


I do not want to exclude this file based on the value of the variable 
CMAKE_BUILD_TYPE.   ;-)




I don't think it would make to do this based on preprocessor definitions.


It seems that our ideas converge.   :-)



So, toy.cxx is not actually the problem,


Correct.



but you don't want to link against the XML library.


Partly. yes.

I am affected by a general issue from C++ class libraries. The corresponding 
free source files were copied to a subdirectory of the project I am interested 
in because a public shared library (*.so/*.dll) seems to be missing for it. (The 
project has got its own bundle of external software.)


Library features are used in a limited way so far. This has got the consequence 
that its compilation should be optional for specific application parts.




Do you need the library anyways (e.g. for other targets) [...] ?


The software test part depends on the C++ class library unconditionally.



However, if libxml is required for debugging only and you don't want to
require it unconditionally, you have a problem and I can't see an easy
way around it.


The utility http://grinninglizard.com/tinyxml/index.html; is needed in my case.

Regards,
Markus
___
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 query compiler definitions?

2011-01-19 Thread Michael Wild
On 01/19/2011 03:45 PM, SF Markus Elfring wrote:
 set_source_files_properties(debug_funcs.c PROPERTIES
EXCLUDE_FROM_CONFIGURATIONS Release;MinSizeRel)
 
 I do not want to exclude this file based on the value of the variable
 CMAKE_BUILD_TYPE.   ;-)

Why not? That's mostly equivalent to doing it based on -DNDEBUG (which
is automatically defined for Release and MinSizeRel). Or is it actually
another criterion (such as whether testing is enabled)?

 
 
 I don't think it would make to do this based on preprocessor definitions.
 
 It seems that our ideas converge.   :-)
 
 
 So, toy.cxx is not actually the problem,
 
 Correct.
 
 
 but you don't want to link against the XML library.
 
 Partly. yes.
 
 I am affected by a general issue from C++ class libraries. The
 corresponding free source files were copied to a subdirectory of the
 project I am interested in because a public shared library (*.so/*.dll)
 seems to be missing for it. (The project has got its own bundle of
 external software.)
 
 Library features are used in a limited way so far. This has got the
 consequence that its compilation should be optional for specific
 application parts.
 
 
 Do you need the library anyways (e.g. for other targets) [...] ?
 
 The software test part depends on the C++ class library unconditionally.

So, you always build tinyxml? In that case, simply use this:

8

add_library(tinyxml STATIC
  tinyxml/tinystr.cpp
  tinyxml/tinyxml.cpp
  tinyxml/tinyxmlerror.cpp
  tinyxml/tinyxmlparser.cpp)

8

add_executable(super a.cpp b.cpp c.cpp toy.cpp)
target_link_libraries(super debug tinyxml)

In that case, super will be linked against the tinyxml target only for
the debugging configurations.

 
 
 However, if libxml is required for debugging only and you don't want to
 require it unconditionally, you have a problem and I can't see an easy
 way around it.
 
 The utility http://grinninglizard.com/tinyxml/index.html; is needed in
 my case.
 
 Regards,
 Markus

Michael
___
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 query compiler definitions?

2011-01-19 Thread SF Markus Elfring

Why not? That's mostly equivalent to doing it based on -DNDEBUG (which
is automatically defined for Release and MinSizeRel).


I would like to be precise here.

Do any configurations exist in the software development world where the build 
type Release does not include a definition for this preprocessor symbol?




So, you always build tinyxml?


Its compilation should depend on the application part that uses objects and 
corresponding member functions from this C++ class library.




add_library(tinyxml STATIC


By the way:
How do you think about the attachment for the feature request Use CMake for 
build system?

https://sourceforge.net/tracker/?func=detailaid=3151377group_id=13559atid=363559


I imagine that you might be affected with your project FreeFOAM in a similar 
way if I would dare to bundle its source files into an other project. I am 
curious if we will find more useful ideas for the involved issues.


Regards,
Markus
___
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