[CMake] include directories,

2011-08-04 Thread Łukasz Tasz
Hi All,

I have a question according include_directories() function and
INCLUDE_DIRECTORIES directory property.

Is it possible that I will know set of include directories that will
be used by preprocessor when I'm calling add_executable function?

I notticed, that order does not matter, for example:

add_library(test test.cxx)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}libtest")
add_library(test1 test1.cxx)

both targets will have the same include directories.

so from CMake phase I'm not able to check what will be includes
configuration, INCLUDE_DIRECTORIES property contain only current one.

is this expected behaviour or this can be tuned by setting some policy?

thanks in advance
Lukasz Tasz



-- 
Lukasz Tasz
___
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 directories

2011-12-28 Thread Tom Deblauwe

Hello,

I have the following project structure:

framework1/inc/lib1 <- public headers
framework1/inc/lib2 <- public headers
framework1/libs/lib1/ <- CMakeLists.txt
framework1/libs/lib1/src <- implementation source+headers
framework1/libs/lib2/ <- CMakeLists.txt
framework1/libs/lib2/src <- implementation source+headers
framework1/tests/lib1/ <- CMakeLists.txt
framework1/tests/lib1/src <- unittest for lib1
framework1/tests/lib2/ <- CMakeLists.txt
framework1/tests/lib2/src <- unittest for lib2

In the cmakelists.txt in "framework1/libs/lib1" I do an 
"add_subdirectory(../../tests/lib1)" and also the add_test(). This works 
great. But the unittest has to do an 
"include_directory(../../tests/lib1/src)" so that the unittest can use 
the private implementation headers. This also works great.


But the problem comes when someone want to use the lib1: it 
automatically adds the unittest, which adds the include of the private 
implementation src and this is not good because when someone wants to 
use the lib1 he should only have the public include dir 
"framework1/inc/lib1" and have the extra "framework1/tests/lib1/src" as 
include directory. How can I solve this?


Best regards,
Tom,
--

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] include directories,

2011-08-10 Thread Łukasz Tasz
Hi All,

Can somebody please advise me with this topic, if it is expected
behaviour or a bug?

thanks in advance
Lukasz

2011/8/4 Łukasz Tasz :
> Hi All,
>
> I have a question according include_directories() function and
> INCLUDE_DIRECTORIES directory property.
>
> Is it possible that I will know set of include directories that will
> be used by preprocessor when I'm calling add_executable function?
>
> I notticed, that order does not matter, for example:
>
> add_library(test test.cxx)
> include_directories("${CMAKE_CURRENT_SOURCE_DIR}libtest")
> add_library(test1 test1.cxx)
>
> both targets will have the same include directories.
>
> so from CMake phase I'm not able to check what will be includes
> configuration, INCLUDE_DIRECTORIES property contain only current one.
>
> is this expected behaviour or this can be tuned by setting some policy?
>
> thanks in advance
> Lukasz Tasz
>
>
>
> --
> Lukasz Tasz
>



-- 
Lukasz Tasz
___
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] include directories,

2011-08-10 Thread Michael Wild
On Wed 10 Aug 2011 04:51:36 PM CEST, Łukasz Tasz wrote:
> Hi All,
> 
> Can somebody please advise me with this topic, if it is expected
> behaviour or a bug?
> 
> thanks in advance
> Lukasz
> 
> 2011/8/4 Łukasz Tasz :
>> Hi All,
>>
>> I have a question according include_directories() function and
>> INCLUDE_DIRECTORIES directory property.
>>
>> Is it possible that I will know set of include directories that will
>> be used by preprocessor when I'm calling add_executable function?
>>
>> I notticed, that order does not matter, for example:
>>
>> add_library(test test.cxx)
>> include_directories("${CMAKE_CURRENT_SOURCE_DIR}libtest")
>> add_library(test1 test1.cxx)
>>
>> both targets will have the same include directories.
>>
>> so from CMake phase I'm not able to check what will be includes
>> configuration, INCLUDE_DIRECTORIES property contain only current one.
>>
>> is this expected behaviour or this can be tuned by setting some policy?
>>
>> thanks in advance
>> Lukasz Tasz

It is expected behaviour. The INCLUDE_DIRECTORIES is a directory
property, and applies to *all* targets defined in that directory. The
targets themselves get generated *after* the processing of the full
CMakeLists.txt file in this directory. However, the get_directory() call
gets evaluated immediately.

I suspect what you want is different include paths for some of the files
or targets, right? Currently the only solution is to put these targets
into different directories. If you need file-level differentiation,
you'll need static libraries in distinct directories.

I know, it is a PITA and has caused much grief for a lot of people on
this list... ;-)


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] include directories,

2011-08-11 Thread Łukasz Tasz
Hi Michael, All

Thanks a lot for your explanation,
Now it's obvious for me why it behaves like that, include directories
is inherited from directory properties, and this will be stable after
processing cmakelists.

What I want to do is a little bit different, I would like to reset
value of INCLUDE_DIRECTORIES.
I know that man pages says that this property is read_only, but in all
cases that I need cmake is allowing me to change it this. (again I
don't know if this is misbehaviours or property is not readonly
anymore?)

In my project I have wrapper macro for adding libraries and
executables, and I need to manipulate includes a little, I wanted to
do this in wrapper macro, but it looks like I need to find some other
hook to attach in place when CMakelists will be processed.

Any ideas?

thanks a lot
Lukasz


2011/8/10 Michael Wild :
> On Wed 10 Aug 2011 04:51:36 PM CEST, Łukasz Tasz wrote:
>> Hi All,
>>
>> Can somebody please advise me with this topic, if it is expected
>> behaviour or a bug?
>>
>> thanks in advance
>> Lukasz
>>
>> 2011/8/4 Łukasz Tasz :
>>> Hi All,
>>>
>>> I have a question according include_directories() function and
>>> INCLUDE_DIRECTORIES directory property.
>>>
>>> Is it possible that I will know set of include directories that will
>>> be used by preprocessor when I'm calling add_executable function?
>>>
>>> I notticed, that order does not matter, for example:
>>>
>>> add_library(test test.cxx)
>>> include_directories("${CMAKE_CURRENT_SOURCE_DIR}libtest")
>>> add_library(test1 test1.cxx)
>>>
>>> both targets will have the same include directories.
>>>
>>> so from CMake phase I'm not able to check what will be includes
>>> configuration, INCLUDE_DIRECTORIES property contain only current one.
>>>
>>> is this expected behaviour or this can be tuned by setting some policy?
>>>
>>> thanks in advance
>>> Lukasz Tasz
>
> It is expected behaviour. The INCLUDE_DIRECTORIES is a directory
> property, and applies to *all* targets defined in that directory. The
> targets themselves get generated *after* the processing of the full
> CMakeLists.txt file in this directory. However, the get_directory() call
> gets evaluated immediately.
>
> I suspect what you want is different include paths for some of the files
> or targets, right? Currently the only solution is to put these targets
> into different directories. If you need file-level differentiation,
> you'll need static libraries in distinct directories.
>
> I know, it is a PITA and has caused much grief for a lot of people on
> this list... ;-)
>
>
> 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



-- 
Lukasz Tasz
___
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 directories variable?

2007-09-26 Thread Juan Sanchez
How do I get the INCLUDE_DIRECTORIES path?  I need to feed into into the
search path for the swig command line.

Thanks,

Juan


___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


[CMake] include directories getting excaped.

2009-06-22 Thread chris
Hi,

I've got this bit of cmake code:
PKG_CHECK_MODULES(GTKMM gtkmm-2.4 REQUIRED)
IF(NOT GTKMM_FOUND)
  MESSAGE("GTKMM is required to compile this project." FATAL_ERROR)
ENDIF(NOT GTKMM_FOUND)
MESSAGE("gtkmm headers: ${GTKMM_INCLUDE_DIRS}")

and the message I get under windows is:
C:/Program
and nothing else.
I also see that exact same directory in my vc9 project. It works under linux.

Here is my include dir line.
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR} ../libShaderGraph
${GTKMM_INCLUDE_DIRS} ../include ../scene
${PYTHON_INCLUDE_PATH} "/usr/include/eigen2"
${GLEW_INCLUDE_PATH}

The funny thing is that I google code searched CMakeLists.txt files and
found that everybody seems to be doing this the same way as I am? Am I the
 only person with this problem, or is everybody using CMake under linux
only?

thanks.

___
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] include directories variable?

2007-09-27 Thread Sylvain Benner



How do I get the INCLUDE_DIRECTORIES path?  I need to feed into into the
search path for the swig command line.
  

Documentation taken from a "man cmake" command:

GET_DIRECTORY_PROPERTY
  Get a property of the directory.

GET_DIRECTORY_PROPERTY(VAR [DIRECTORY dir] property)

  Get a property from the Directory.  The value of the property is
  stored  in the variable VAR. If the property is not found, CMake
  will  report  an  error.  The  properties  include:   VARIABLES,
  CACHE_VARIABLES,COMMANDS,MACROS,INCLUDE_DIRECTORIES,
  LINK_DIRECTORIES, DEFINITIONS, INCLUDE_REGULAR_EXPRESSION, LIST-
  FILE_STACK,  PARENT_DIRECTORY,  and  DEFINITION varname.  If the
  DIRECTORY argument is provided then the property of the provided
  directory  will  be  retrieved instead of the current directory.
  You can only get properties of a directory during  or  after  it
  has been traversed by cmake.

--Sylvain

___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] include directories getting excaped.

2009-06-22 Thread Tyler Roscoe
On Mon, Jun 22, 2009 at 02:25:17AM -0500, ch...@basementcode.com wrote:
> I've got this bit of cmake code:
> PKG_CHECK_MODULES(GTKMM gtkmm-2.4 REQUIRED)
> IF(NOT GTKMM_FOUND)
>   MESSAGE("GTKMM is required to compile this project." FATAL_ERROR)
> ENDIF(NOT GTKMM_FOUND)
> MESSAGE("gtkmm headers: ${GTKMM_INCLUDE_DIRS}")
> 
> and the message I get under windows is:
> C:/Program
> and nothing else.

Your message really doesn't include the "gtkmm headers: " part? If so,
you have something weird going on.

Maybe try cmake --trace to see if something jumps out at you?

> Here is my include dir line.
> INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR} ../libShaderGraph
> ${GTKMM_INCLUDE_DIRS} ../include ../scene
>   ${PYTHON_INCLUDE_PATH} "/usr/include/eigen2"
>   ${GLEW_INCLUDE_PATH}
> 
> The funny thing is that I google code searched CMakeLists.txt files and
> found that everybody seems to be doing this the same way as I am? Am I the
>  only person with this problem, or is everybody using CMake under linux
> only?

That snippet looks reasonable and ought to work on any platform. I mean,
you left off the trailing ) but I assume that's a typo.

tyler
___
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] include directories getting excaped.

2009-06-22 Thread Christopher Harvey
wowI typed that at 2:25am last night. so many typos

I actually found out what's going on. It's not cmakes fault, pkg-config
under windows is returning that exact same string, but I didn't notice
because --cflags looked alright. when using --cflags-only-I I get the
C:\Program thing. Maybe I'll find a FindGTKMM.cmake instead.

thanks anyway.

Tyler Roscoe wrote:
> On Mon, Jun 22, 2009 at 02:25:17AM -0500, ch...@basementcode.com wrote:
>   
>> I've got this bit of cmake code:
>> PKG_CHECK_MODULES(GTKMM gtkmm-2.4 REQUIRED)
>> IF(NOT GTKMM_FOUND)
>>   MESSAGE("GTKMM is required to compile this project." FATAL_ERROR)
>> ENDIF(NOT GTKMM_FOUND)
>> MESSAGE("gtkmm headers: ${GTKMM_INCLUDE_DIRS}")
>>
>> and the message I get under windows is:
>> C:/Program
>> and nothing else.
>> 
>
> Your message really doesn't include the "gtkmm headers: " part? If so,
> you have something weird going on.
>
> Maybe try cmake --trace to see if something jumps out at you?
>
>   
>> Here is my include dir line.
>> INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR} ../libShaderGraph
>> ${GTKMM_INCLUDE_DIRS} ../include ../scene
>>  ${PYTHON_INCLUDE_PATH} "/usr/include/eigen2"
>>  ${GLEW_INCLUDE_PATH}
>>
>> The funny thing is that I google code searched CMakeLists.txt files and
>> found that everybody seems to be doing this the same way as I am? Am I the
>>  only person with this problem, or is everybody using CMake under linux
>> only?
>> 
>
> That snippet looks reasonable and ought to work on any platform. I mean,
> you left off the trailing ) but I assume that's a typo.
>
> tyler
>   

___
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 Directories Cleanup/Remove Prior Entries

2010-11-09 Thread Jeremy Torres
I have a question regarding removing prior entries from include_directories.  
Specifically, in a CMakeLists.txt, I have several targets.  For example:

# target 1
include_directories(x y z)
add_executable(my_exe ...)

#target 2
include_directories(a b c)
add_executable(my_exe2 ...)

#target 3


#target N


I would like to be able to "cleanup" all includes for each target2 so that they 
ONLY include the target-specified includes.  I have looked through mailing 
lists, etc, and I only see the set_directory_properties(PROPERITES 
INCLUDE_DIRECTORES ""). I have tried this but it does not work.

Thanks in advance for your help,

Jeremy
___
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 directories for C compile command

2011-08-02 Thread Andrei Buzgan
Hello everyone,

I'm trying to set up an environment for building a pre-existing medium sized
embedded software project, by using CMake 2.8 and MinGW. The compiler kit is
specific for the target microcontroller and contains C compiler, assembler,
linker, all different executables.

I do have some restrictions:
The project structure looks like this:
Sources
|-- SWC1
||-- swc1.c
||-- swc1.h
||--CMakeLists.txt
|-- SWC2
||-- swc2_a.c
||-- swc2_b.c
||-- swc2.h
||--CMakeLists.txt
|-- COMMON
||-- config1.h
||-- config2.h
||--CMakeLists.txt
|-- UNUSED_DIR
|-- SWC3
||-- swc3.obj
||-- swc3.h


- I cannot change the directory structure of the project (i can add but i
must not move files around)

- each SW module (component) has it own files including interface headers in
it's own directory
(SW component SWC1 resides in folder SWC1 and contains a source file and a
header file)

- SW modules may be interfaced with any other module
(swc1.c may include swc2.h...)

- There are common header files with project scope definitions and
configurations which reside in their own directory too
(both swc1.c and swc2.c may include headers config1.h and config2.h)

- The SW has more variants, some variants use different C source files for a
specific SW component but the sources reside in the same directory and
interface headers are common for all variants.
(For SW variant A the SW component SWC2 uses swc2_a.c source file, for SW
variant B it uses swc2_b.c file)

- Some SW components are precompiled and provided as object files together
with the interface header (SWC3)

*These being the conditions, i couldn't manage to gather the relevant
folders in order to correctly create the build object command *where "flags"
like -I -I ... are expected in order to look for
included headers. Due to mixed source-precompiled objects I chose to define
each component as a static library (add_library(...)) in each CMakeLists.txt
file and list there the used source files, being able to use conditions for
SW variants and basically add different library definitions for each
variant. I intend to add the pre-compiled sources as IMPORTED libraries and
in the end just link the "libraries" with the specific linker command for
linking any object files (but i didn't get there yet!)

I'm currently use the default  CMAKE_C_COMPILE_OBJECT command
   -o-c , the compiler
ignoring the unknown flags ("-c" in this case). *Without any explicit
configuration from my part, it looks like  variable contains also a
-I directive for the current compiled source file* ( is the same
directory where the source files about to be compiled resides).

I tried to use "set( CMAKE_INCLUDE_CURRENT_DIR ON )" in each CMakeLists.txt
file but  variable seems not to be updated this way.

I'd like to know if there is an efficient method to build an include
directory list in order to pass it to compile flags. It would be very useful
to make this in CMakeLists.txt file or link it somehow to add_directory(dir)
and use an internal CMake mechanism trying to avoid creating this part of
the compiler flags manually in order to be easily maintained in the future.

Thanks,
Andrei
___
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] Include Directories Cleanup/Remove Prior Entries

2010-11-10 Thread Alexander Neundorf
On Wednesday 10 November 2010, Jeremy Torres wrote:
> I have a question regarding removing prior entries from
> include_directories.  Specifically, in a CMakeLists.txt, I have several
> targets.  For example:
>
> # target 1
> include_directories(x y z)
> add_executable(my_exe ...)
>
> #target 2
> include_directories(a b c)
> add_executable(my_exe2 ...)
>
> #target 3
> 
>
> #target N
>
>
> I would like to be able to "cleanup" all includes for each target2 so that
> they ONLY include the target-specified includes.  I have looked through
> mailing lists, etc, and I only see the set_directory_properties(PROPERITES
> INCLUDE_DIRECTORES ""). I have tried this but it does not work.

If you need this, you have to put these targets into separate subdirectories.
The INCLUDE_DIRECTORIES are per directory, so this is AFAIK the only way to do 
it right now.

Alex
___
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] Include directories for C compile command

2011-08-03 Thread Glenn Coombs
Have you tried using the include_directories() command ?  In your top level
CMakeLists.txt add a line like this:

include_directories(SWC1 SWC2 SWC3 Common)

before you do any add_subdirectory() commands.

Does that not add the appropriate -Ixxx flags to the compile command ?  It
does for me but I'm using Visual Studio and gcc rather than an embedded
compiler.

On 3 August 2011 07:25, Andrei Buzgan  wrote:

> Hello everyone,
>
> I'm trying to set up an environment for building a pre-existing medium
> sized embedded software project, by using CMake 2.8 and MinGW. The compiler
> kit is specific for the target microcontroller and contains C compiler,
> assembler, linker, all different executables.
>
> I do have some restrictions:
> The project structure looks like this:
> Sources
> |-- SWC1
> ||-- swc1.c
> ||-- swc1.h
> ||--CMakeLists.txt
> |-- SWC2
> ||-- swc2_a.c
> ||-- swc2_b.c
> ||-- swc2.h
> ||--CMakeLists.txt
> |-- COMMON
> ||-- config1.h
> ||-- config2.h
> ||--CMakeLists.txt
> |-- UNUSED_DIR
> |-- SWC3
> ||-- swc3.obj
> ||-- swc3.h
>
>
> - I cannot change the directory structure of the project (i can add but i
> must not move files around)
>
> - each SW module (component) has it own files including interface headers
> in it's own directory
> (SW component SWC1 resides in folder SWC1 and contains a source file and a
> header file)
>
> - SW modules may be interfaced with any other module
> (swc1.c may include swc2.h...)
>
> - There are common header files with project scope definitions and
> configurations which reside in their own directory too
> (both swc1.c and swc2.c may include headers config1.h and config2.h)
>
> - The SW has more variants, some variants use different C source files for
> a specific SW component but the sources reside in the same directory and
> interface headers are common for all variants.
> (For SW variant A the SW component SWC2 uses swc2_a.c source file, for SW
> variant B it uses swc2_b.c file)
>
> - Some SW components are precompiled and provided as object files together
> with the interface header (SWC3)
>
> *These being the conditions, i couldn't manage to gather the relevant
> folders in order to correctly create the build object command *where
> "flags" like -I -I ... are expected in order to look
> for included headers. Due to mixed source-precompiled objects I chose to
> define each component as a static library (add_library(...)) in each
> CMakeLists.txt file and list there the used source files, being able to use
> conditions for SW variants and basically add different library definitions
> for each variant. I intend to add the pre-compiled sources as IMPORTED
> libraries and in the end just link the "libraries" with the specific linker
> command for linking any object files (but i didn't get there yet!)
>
> I'm currently use the default  CMAKE_C_COMPILE_OBJECT command
>-o-c , the compiler
> ignoring the unknown flags ("-c" in this case). *Without any explicit
> configuration from my part, it looks like  variable contains also a
> -I directive for the current compiled source file* ( is the
> same directory where the source files about to be compiled resides).
>
> I tried to use "set( CMAKE_INCLUDE_CURRENT_DIR ON )" in each CMakeLists.txt
> file but  variable seems not to be updated this way.
>
> I'd like to know if there is an efficient method to build an include
> directory list in order to pass it to compile flags. It would be very useful
> to make this in CMakeLists.txt file or link it somehow to add_directory(dir)
> and use an internal CMake mechanism trying to avoid creating this part of
> the compiler flags manually in order to be easily maintained in the future.
>
> Thanks,
> Andrei
>
>
>
>
> ___
> 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

Re: [CMake] Include directories for C compile command

2011-08-03 Thread Andrei Buzgan
Hello Glenn and thanks,

I found out yesterday the method you describe works. I was trying to use
include_directories() before, but unfortunately the statement was after any
add_directory() statement and it was a matter of scope (what other
variable/property updates add_directory() does?).
It works now, but still I'm wondering if there is a method of doing the same
thing at module level (leaf CMakeLists.txt files) and propagate the updates
upwards in directory hierarchy.

Thanks again,

Andrei



On Wed, Aug 3, 2011 at 8:10 PM, Glenn Coombs  wrote:

> Have you tried using the include_directories() command ?  In your top level
> CMakeLists.txt add a line like this:
>
> include_directories(SWC1 SWC2 SWC3 Common)
>
> before you do any add_subdirectory() commands.
>
> Does that not add the appropriate -Ixxx flags to the compile command ?  It
> does for me but I'm using Visual Studio and gcc rather than an embedded
> compiler.
>
> On 3 August 2011 07:25, Andrei Buzgan  wrote:
>
>> Hello everyone,
>>
>> I'm trying to set up an environment for building a pre-existing medium
>> sized embedded software project, by using CMake 2.8 and MinGW. The compiler
>> kit is specific for the target microcontroller and contains C compiler,
>> assembler, linker, all different executables.
>>
>> I do have some restrictions:
>> The project structure looks like this:
>> Sources
>> |-- SWC1
>> ||-- swc1.c
>> ||-- swc1.h
>> ||--CMakeLists.txt
>> |-- SWC2
>> ||-- swc2_a.c
>> ||-- swc2_b.c
>> ||-- swc2.h
>> ||--CMakeLists.txt
>> |-- COMMON
>> ||-- config1.h
>> ||-- config2.h
>> ||--CMakeLists.txt
>> |-- UNUSED_DIR
>> |-- SWC3
>> ||-- swc3.obj
>> ||-- swc3.h
>>
>>
>> - I cannot change the directory structure of the project (i can add but i
>> must not move files around)
>>
>> - each SW module (component) has it own files including interface headers
>> in it's own directory
>> (SW component SWC1 resides in folder SWC1 and contains a source file and a
>> header file)
>>
>> - SW modules may be interfaced with any other module
>> (swc1.c may include swc2.h...)
>>
>> - There are common header files with project scope definitions and
>> configurations which reside in their own directory too
>> (both swc1.c and swc2.c may include headers config1.h and config2.h)
>>
>> - The SW has more variants, some variants use different C source files for
>> a specific SW component but the sources reside in the same directory and
>> interface headers are common for all variants.
>> (For SW variant A the SW component SWC2 uses swc2_a.c source file, for SW
>> variant B it uses swc2_b.c file)
>>
>> - Some SW components are precompiled and provided as object files together
>> with the interface header (SWC3)
>>
>> *These being the conditions, i couldn't manage to gather the relevant
>> folders in order to correctly create the build object command *where
>> "flags" like -I -I ... are expected in order to look
>> for included headers. Due to mixed source-precompiled objects I chose to
>> define each component as a static library (add_library(...)) in each
>> CMakeLists.txt file and list there the used source files, being able to use
>> conditions for SW variants and basically add different library definitions
>> for each variant. I intend to add the pre-compiled sources as IMPORTED
>> libraries and in the end just link the "libraries" with the specific linker
>> command for linking any object files (but i didn't get there yet!)
>>
>> I'm currently use the default  CMAKE_C_COMPILE_OBJECT command
>>-o-c , the compiler
>> ignoring the unknown flags ("-c" in this case). *Without any explicit
>> configuration from my part, it looks like  variable contains also a
>> -I directive for the current compiled source file* ( is the
>> same directory where the source files about to be compiled resides).
>>
>> I tried to use "set( CMAKE_INCLUDE_CURRENT_DIR ON )" in each
>> CMakeLists.txt file but  variable seems not to be updated this way.
>>
>> I'd like to know if there is an efficient method to build an include
>> directory list in order to pass it to compile flags. It would be very useful
>> to make this in CMakeLists.txt file or link it somehow to add_directory(dir)
>> and use an internal CMake mechanism trying to avoid creating this part of
>> the compiler flags manually in order to be easily maintained in the future.
>>
>> Thanks,
>> Andrei
>>
>>
>>
>>
>> ___
>> 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 m

Re: [CMake] Include directories for C compile command

2011-08-04 Thread Glenn Coombs
CMake deliberately works in a top-down manner for most things.  So variable
values and preprocessor definitions are inherited in subdirectories from the
values they had in the parent.  And any subsequent changes made to them in
the subdirectory scope are not propogated up to the parent.  This is a good
thing in my opinion because it allows you to isolate components from one
another.

If you try to work against this you will find it difficult as CMake doesn't
work that way.

On 4 August 2011 06:15, Andrei Buzgan  wrote:

> Hello Glenn and thanks,
>
> I found out yesterday the method you describe works. I was trying to use
> include_directories() before, but unfortunately the statement was after any
> add_directory() statement and it was a matter of scope (what other
> variable/property updates add_directory() does?).
> It works now, but still I'm wondering if there is a method of doing the
> same thing at module level (leaf CMakeLists.txt files) and propagate the
> updates upwards in directory hierarchy.
>
> Thanks again,
>
> Andrei
>
>
>
>
> On Wed, Aug 3, 2011 at 8:10 PM, Glenn Coombs wrote:
>
>> Have you tried using the include_directories() command ?  In your top
>> level CMakeLists.txt add a line like this:
>>
>> include_directories(SWC1 SWC2 SWC3 Common)
>>
>> before you do any add_subdirectory() commands.
>>
>> Does that not add the appropriate -Ixxx flags to the compile command ?  It
>> does for me but I'm using Visual Studio and gcc rather than an embedded
>> compiler.
>>
>> On 3 August 2011 07:25, Andrei Buzgan  wrote:
>>
>>> Hello everyone,
>>>
>>> I'm trying to set up an environment for building a pre-existing medium
>>> sized embedded software project, by using CMake 2.8 and MinGW. The compiler
>>> kit is specific for the target microcontroller and contains C compiler,
>>> assembler, linker, all different executables.
>>>
>>> I do have some restrictions:
>>> The project structure looks like this:
>>> Sources
>>> |-- SWC1
>>> ||-- swc1.c
>>> ||-- swc1.h
>>> ||--CMakeLists.txt
>>> |-- SWC2
>>> ||-- swc2_a.c
>>> ||-- swc2_b.c
>>> ||-- swc2.h
>>> ||--CMakeLists.txt
>>> |-- COMMON
>>> ||-- config1.h
>>> ||-- config2.h
>>> ||--CMakeLists.txt
>>> |-- UNUSED_DIR
>>> |-- SWC3
>>> ||-- swc3.obj
>>> ||-- swc3.h
>>>
>>>
>>> - I cannot change the directory structure of the project (i can add but i
>>> must not move files around)
>>>
>>> - each SW module (component) has it own files including interface headers
>>> in it's own directory
>>> (SW component SWC1 resides in folder SWC1 and contains a source file and
>>> a header file)
>>>
>>> - SW modules may be interfaced with any other module
>>> (swc1.c may include swc2.h...)
>>>
>>> - There are common header files with project scope definitions and
>>> configurations which reside in their own directory too
>>> (both swc1.c and swc2.c may include headers config1.h and config2.h)
>>>
>>> - The SW has more variants, some variants use different C source files
>>> for a specific SW component but the sources reside in the same directory and
>>> interface headers are common for all variants.
>>> (For SW variant A the SW component SWC2 uses swc2_a.c source file, for SW
>>> variant B it uses swc2_b.c file)
>>>
>>> - Some SW components are precompiled and provided as object files
>>> together with the interface header (SWC3)
>>>
>>> *These being the conditions, i couldn't manage to gather the relevant
>>> folders in order to correctly create the build object command *where
>>> "flags" like -I -I ... are expected in order to look
>>> for included headers. Due to mixed source-precompiled objects I chose to
>>> define each component as a static library (add_library(...)) in each
>>> CMakeLists.txt file and list there the used source files, being able to use
>>> conditions for SW variants and basically add different library definitions
>>> for each variant. I intend to add the pre-compiled sources as IMPORTED
>>> libraries and in the end just link the "libraries" with the specific linker
>>> command for linking any object files (but i didn't get there yet!)
>>>
>>> I'm currently use the default  CMAKE_C_COMPILE_OBJECT command
>>>-o-c , the compiler
>>> ignoring the unknown flags ("-c" in this case). *Without any explicit
>>> configuration from my part, it looks like  variable contains also a
>>> -I directive for the current compiled source file* ( is the
>>> same directory where the source files about to be compiled resides).
>>>
>>> I tried to use "set( CMAKE_INCLUDE_CURRENT_DIR ON )" in each
>>> CMakeLists.txt file but  variable seems not to be updated this way.
>>>
>>> I'd like to know if there is an efficient method to build an include
>>> directory list in order to pass it to compile flags. It would be very useful
>>> to make this in CMakeLists.txt file or link it somehow to add_directory(dir)
>>> and use an internal CMake mechanism trying to avoid creating this part of
>>> the compiler flags manually in order to

[CMake] Include directories of IMPORTED libraries not propagating

2017-12-22 Thread Saad Khattak
Hi,

I have the following setup:

ImportedLib (sets location of library files and public include directories)
LibA (publicly includes ImporteLib with
target_link_libraries(...))
Exe  (finds LibA and links against it)

Where ImportedLib uses "set_target_properties(ImportedLib PROPERTIES
IMPORTED_LOCATION_DEBUG ... INTERFACE_INCLUDE_DIRECTORIES ...)" to set its
include directories and prebuilt libraries for linking.

LibA uses "target_link_libraries(LibA PUBLIC ImportedLib)". CMake correctly
generates the project such that LibA now has the include directories of the
ImportedLib. LibA then uses the "install(...)" feature so that "Exe" can
find LibA.

With Exe, I find LibA using "find_package(LibA REQUIRED)" and then
"target_link_libraries(Exe LibA)". Exe inherits LibA's include directories
and links against it. Exe is also able to link against ImportedLib.
However, what Exe does not inherit is the public include directories
specified by ImportedLib. This seems like a bug because it is able to know
about and is able to link against ImportLib prebuilt library files.

If it's not a bug, how do I make sure ImportedLib include directories are
propagated properly?

Regards,
Saad
-- 

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] include directories not found for object library

2018-05-08 Thread Miklos Espak
Hi,

I have an abstract class that I want to compile into many applications.
Something like this:

baseapp.h
baseapp.cpp
app1.h
app1.cpp
app2.h
app2.cpp
...

I thought of making an object library from baseapp because I want to
compile it only once and it is used only internally.

However, baseapp depends on other libraries, e.g. dcmjpeg, mylib1 and
mylib2, and the include directories of these of these libraries are not
found. For regular libraries and executables, the include directories are
picked up from the target property of the linked libraries, but for object
libraries you cannot specify target link libraries.

I came up with this:

add_library(baseapp OBJECT baseapp.h baseapp.cpp)
target_include_directories(baseapp PUBLIC
  $
  $
  $)

This works, but it does not look too pretty to me.

I am wondering if there is a more elegant way.

E.g. would it be a good idea to propagate the include dirs with the
add_dependencies command? E.g. instead of the above, one could write:

add_dependencies(baseapp dcmjpeg mylib1 mylib2)

Cheers,
Miklos
-- 

Powered by www.kitware.com

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

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

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

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


[CMake] Include directories problem when cross compiling with MinGW

2016-09-02 Thread David Demelier
Hello,

I'm trying to cross compile a project on Arch Linux using MinGW for
Windows.

I've installed a lot of libraries from their AUR into /usr/x86_64-w64-
mingw32. This seems okay as CMake finds every library needed.

My example project consists of:

cmake_minimum_required(VERSION 3.5)
project(test)
find_package(PNG REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main PNG::PNG)

The main.cpp only contains an #include  statement.

The toolchain file contains:

set (CMAKE_SYSTEM_NAME Windows)
set (CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
set (CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
set (CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set (QT_BINARY_DIR /usr/x86_64-w64-mingw32/bin /usr/bin)
set (QT_INCLUDE_DIRS_NO_SYSTEM ON)
set (CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
set (CMAKE_MC_COMPILER x86_64-w64-mingw32-windmc)
set (Boost_THREADAPI win32)
set (CMAKE_Fortran_COMPILER x86_64-w64-mingw32-gfortran)
set (CMAKE_AR:FILEPATH x86_64-w64-mingw32-ar)
set (CMAKE_RANLIB:FILEPATH x86_64-w64-mingw32-ranlib)

Then, running CMake with that toolchain produce:

$ cmake -DCMAKE_TOOLCHAIN_FILE=/usr/share/mingw/toolchain-x86_64-w64-
mingw32.cmake ..
-- The C compiler identification is GNU 6.1.1
-- The CXX compiler identification is GNU 6.1.1
-- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc
-- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc --
works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/x86_64-w64-mingw32-g++
-- Check for working CXX compiler: /usr/bin/x86_64-w64-mingw32-g++ --
works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: /usr/x86_64-w64-mingw32/lib/libz.dll.a (found version
"1.2.8") 
-- Found PNG: /usr/x86_64-w64-mingw32/lib/libpng.dll.a (found version
"1.6.24") 
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/test/build

So as you can see, the libraries are correctly found. However, compile
fails with:

$ make
Scanning dependencies of target main
[ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.obj
In file included from /tmp/test/main.cpp:1:0:
/usr/x86_64-w64-mingw32/include/c++/6.1.1/cstdlib:75:25: fatal error:
stdlib.h: No such file or directory
 #include_next 
 ^
compilation terminated.

The includes directories specified in the
CMakeFiles/main.dir/includes_CSS.rsp seems to be the culprit:

$ cat CMakeFiles/main.dir/includes_CXX.rsp
-isystem /usr/x86_64-w64-mingw32/include 

Removing that option from the file ends with a successful build. I
don't understand why it does not work with that because stdlib.h can be
found as /usr/x86_64-w64-mingw32/include/stdilb.h.

Do you have any clue?

Regards,

-- 
David Demelier




-- 

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] include directories not found for object library

2018-05-15 Thread Robert Maynard
This is scheduled to be fixed in the next release by allowing OBJECT
libraries to be used in target_link_libraries.



On Tue, May 8, 2018 at 7:46 PM Miklos Espak  wrote:

> Hi,
>
> I have an abstract class that I want to compile into many applications.
> Something like this:
>
> baseapp.h
> baseapp.cpp
> app1.h
> app1.cpp
> app2.h
> app2.cpp
> ...
>
> I thought of making an object library from baseapp because I want to
> compile it only once and it is used only internally.
>
> However, baseapp depends on other libraries, e.g. dcmjpeg, mylib1 and
> mylib2, and the include directories of these of these libraries are not
> found. For regular libraries and executables, the include directories are
> picked up from the target property of the linked libraries, but for object
> libraries you cannot specify target link libraries.
>
> I came up with this:
>
> add_library(baseapp OBJECT baseapp.h baseapp.cpp)
> target_include_directories(baseapp PUBLIC
>   $
>   $
>   $)
>
> This works, but it does not look too pretty to me.
>
> I am wondering if there is a more elegant way.
>
> E.g. would it be a good idea to propagate the include dirs with the
> add_dependencies command? E.g. instead of the above, one could write:
>
> add_dependencies(baseapp dcmjpeg mylib1 mylib2)
>
> Cheers,
> Miklos
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> 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


Re: [CMake] include directories not found for object library

2018-05-16 Thread Miklos Espak
That's awesome, thanks a lot!

So, it would look like this in my case then:

target_link_libraries(baseapp PUBLIC dcmjpeg mylib1 mylib2)

And the object library has to be added to the sources of the app1 and app2,
like now. With other words, object libraries would be allowed on the left
hand side of "target_link_libraries".

This looks the most intuitive way, indeed.

Cheers,
Miklos


On Tue, 15 May 2018 at 16:51, Robert Maynard 
wrote:

> This is scheduled to be fixed in the next release by allowing OBJECT
> libraries to be used in target_link_libraries.
>
>
>
> On Tue, May 8, 2018 at 7:46 PM Miklos Espak  wrote:
>
>> Hi,
>>
>> I have an abstract class that I want to compile into many applications.
>> Something like this:
>>
>> baseapp.h
>> baseapp.cpp
>> app1.h
>> app1.cpp
>> app2.h
>> app2.cpp
>> ...
>>
>> I thought of making an object library from baseapp because I want to
>> compile it only once and it is used only internally.
>>
>> However, baseapp depends on other libraries, e.g. dcmjpeg, mylib1 and
>> mylib2, and the include directories of these of these libraries are not
>> found. For regular libraries and executables, the include directories are
>> picked up from the target property of the linked libraries, but for object
>> libraries you cannot specify target link libraries.
>>
>> I came up with this:
>>
>> add_library(baseapp OBJECT baseapp.h baseapp.cpp)
>> target_include_directories(baseapp PUBLIC
>>   $
>>   $
>>   $)
>>
>> This works, but it does not look too pretty to me.
>>
>> I am wondering if there is a more elegant way.
>>
>> E.g. would it be a good idea to propagate the include dirs with the
>> add_dependencies command? E.g. instead of the above, one could write:
>>
>> add_dependencies(baseapp dcmjpeg mylib1 mylib2)
>>
>> Cheers,
>> Miklos
>>
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more
>> information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> 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


Re: [CMake] include directories not found for object library

2018-05-16 Thread Robert Maynard
That is exactly how it will look.

On Wed, May 16, 2018 at 4:19 AM Miklos Espak  wrote:

> That's awesome, thanks a lot!
>
> So, it would look like this in my case then:
>
> target_link_libraries(baseapp PUBLIC dcmjpeg mylib1 mylib2)
>
> And the object library has to be added to the sources of the app1 and
> app2, like now. With other words, object libraries would be allowed on the
> left hand side of "target_link_libraries".
>
> This looks the most intuitive way, indeed.
>
> Cheers,
> Miklos
>
>
> On Tue, 15 May 2018 at 16:51, Robert Maynard 
> wrote:
>
>> This is scheduled to be fixed in the next release by allowing OBJECT
>> libraries to be used in target_link_libraries.
>>
>>
>>
>> On Tue, May 8, 2018 at 7:46 PM Miklos Espak  wrote:
>>
>>> Hi,
>>>
>>> I have an abstract class that I want to compile into many applications.
>>> Something like this:
>>>
>>> baseapp.h
>>> baseapp.cpp
>>> app1.h
>>> app1.cpp
>>> app2.h
>>> app2.cpp
>>> ...
>>>
>>> I thought of making an object library from baseapp because I want to
>>> compile it only once and it is used only internally.
>>>
>>> However, baseapp depends on other libraries, e.g. dcmjpeg, mylib1 and
>>> mylib2, and the include directories of these of these libraries are not
>>> found. For regular libraries and executables, the include directories are
>>> picked up from the target property of the linked libraries, but for object
>>> libraries you cannot specify target link libraries.
>>>
>>> I came up with this:
>>>
>>> add_library(baseapp OBJECT baseapp.h baseapp.cpp)
>>> target_include_directories(baseapp PUBLIC
>>>   $
>>>   $
>>>   $)
>>>
>>> This works, but it does not look too pretty to me.
>>>
>>> I am wondering if there is a more elegant way.
>>>
>>> E.g. would it be a good idea to propagate the include dirs with the
>>> add_dependencies command? E.g. instead of the above, one could write:
>>>
>>> add_dependencies(baseapp dcmjpeg mylib1 mylib2)
>>>
>>> Cheers,
>>> Miklos
>>>
>>> --
>>>
>>> Powered by www.kitware.com
>>>
>>> Please keep messages on-topic and check the CMake FAQ at:
>>> http://www.cmake.org/Wiki/CMake_FAQ
>>>
>>> Kitware offers various services to support the CMake community. For more
>>> information on each offering, please visit:
>>>
>>> CMake Support: http://cmake.org/cmake/help/support.html
>>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> 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
>
-- 

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] Include directories problem when cross compiling with MinGW

2016-09-12 Thread Maciej Mrozowski
On piątek, 2 września 2016 13:12:27 CEST David Demelier wrote:

> Do you have any clue?

It seems your toolchain does not have include/library path built-in or they 
are different that those it was built with.
You can inspect them by passing one of below parameters to mingw-*-gcc:

  -print-search-dirs   Display the directories in the compiler's search 
path
  -print-libgcc-file-name  Display the name of the compiler's companion 
library
  -print-file-name=   Display the full path to library 
  -print-prog-name=  Display the full path to compiler component 
  -print-multiarch Display the target's normalized GNU triplet, used 
as
   a component in the library path
  -print-multi-directory   Display the root directory for versions of libgcc
  -print-multi-lib Display the mapping between command line options 
and
   multiple library search directories
  -print-multi-os-directory Display the relative path to OS libraries
  -print-sysroot   Display the target libraries directory
  -print-sysroot-headers-suffix Display the sysroot suffix used to find 
headers

In any case, you should additionally set sysroot via CMAKE_CXX_FLAGS (or 
CMAKE_CXX_COMPILER) in your toolchain file:

--sysroot=dir

-- 
regards
MM
-- 

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] Include directories problem when cross compiling with MinGW

2016-09-19 Thread David Demelier
2016-09-12 23:22 GMT+02:00 Maciej Mrozowski :
> On piątek, 2 września 2016 13:12:27 CEST David Demelier wrote:
>
>> Do you have any clue?
>
> It seems your toolchain does not have include/library path built-in or they
> are different that those it was built with.


After some discuss with ngladitz, we discovered some troubles between
gcc 6 and CMake which both have safety guards. We finally added
CMAKE__IMPLICIT_INCLUDE_DIRECTORIES as workaround in our MinGW
scripts and it works fine at the moment.

Thanks for feedback :)

-- 
Demelier David
-- 

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