[CMake] Does set_target_properties compile_flags option override include_directories?

2011-03-30 Thread Laura Auton Garcia
Hello all,
The project I am working on uses pkg-config --cflags option to get the
include directories of an external project, and I am trying to add the
output to the compile_flags option used in set_target_properties. As
well as the pkg-config directory, some other flags are specified and
well recognized by the IDE we are building the project for (Visual
Studio).
The code stands as specified here (run_pkgconfig is a macro):
RUN_PKGCONFIG(--cflags ACE result LINKER_FLAGS)
SET(LINKER_FLAGS ${LINKER_FLAGS} -D_CRT_SECURE_NO_WARNINGS
-DACE_AS_STATIC_LIBS)
SET_TARGET_PROPERTIES(
myproject PROPERTIES
    COMPILE_FLAGS ${LINKER_FLAGS} )

pkg-config output: -Ic:/ace/ace_wrappers/include

The LINKER_FLAGS variable is well set to with this content:
-Ic:/ace/ace_wrappers/include -D_CRT_SECURE_NO_WARNINGS
-DACE_AS_STATIC_LIBS

Prior to this, some include directories from our own project are added
using include_directories statement.
INCLUDE_DIRECTORIES(
   ${MYPROJECT_DIR_PATH}
   ${MYPROJECT_DIR_PATH}/component
   ${MYPROJECT_DIR_PATH}/error
   ${MYPROJECT_DIR_PATH}/libraries)

The project is then built successfully until we open the visual studio
solution generated. After exploring the C/C++ command line properties
of the project, it seems that all the include directories but the one
generated by pkg-config are missing:

/Ic:/ace/ace_wrappers/include /D _CRT_SECURE_NO_WARNINGS /D
ACE_AS_STATIC_LIBS

If I don't add the pkg-config output, then all the directories
included with include-directories appear to be ok:

/IC:/git-projects/myproject /IC:/git-projects/myproject/component
/IC:/git-projects/myproject/error
/IC:/git-projects/myproject/libraries /D _CRT_SECURE_NO_WARNINGS
/D ACE_AS_STATIC_LIBS

So the question is, does compile-flags option override all the
directories included with include_directories? If that's the case,
then how do I add external include directories through pkg-config? I
am pretty new at cmake so any help will be appreciated.

Thank you in advance.
Laura Autón.
___
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] Does set_target_properties compile_flags option override include_directories?

2011-03-30 Thread Eric Noulard
2011/3/30 Laura Auton Garcia darklulu+cm...@gmail.com:
 Hello all,
 The project I am working on uses pkg-config --cflags option to get the
 include directories of an external project, and I am trying to add the
 output to the compile_flags option used in set_target_properties. As
 well as the pkg-config directory, some other flags are specified and
 well recognized by the IDE we are building the project for (Visual
 Studio).
 The code stands as specified here (run_pkgconfig is a macro):
 RUN_PKGCONFIG(--cflags ACE result LINKER_FLAGS)
 SET(LINKER_FLAGS ${LINKER_FLAGS} -D_CRT_SECURE_NO_WARNINGS
 -DACE_AS_STATIC_LIBS)
 SET_TARGET_PROPERTIES(
    myproject PROPERTIES
     COMPILE_FLAGS ${LINKER_FLAGS} )

Did you know that there is a FindPkgConfig.cmake module shipped with CMake?
It may helps you to use PkgConfig.

 pkg-config output: -Ic:/ace/ace_wrappers/include

 The LINKER_FLAGS variable is well set to with this content:
 -Ic:/ace/ace_wrappers/include -D_CRT_SECURE_NO_WARNINGS
 -DACE_AS_STATIC_LIBS

 Prior to this, some include directories from our own project are added
 using include_directories statement.
 INCLUDE_DIRECTORIES(
   ${MYPROJECT_DIR_PATH}
    ${MYPROJECT_DIR_PATH}/component
    ${MYPROJECT_DIR_PATH}/error
    ${MYPROJECT_DIR_PATH}/libraries)

 The project is then built successfully

You mean CMake successfully generate the project files right?
You did not manage to build your project outside Visual Studio?

 until we open the visual studio
 solution generated. After exploring the C/C++ command line properties
 of the project, it seems that all the include directories but the one
 generated by pkg-config are missing:

 /Ic:/ace/ace_wrappers/include /D _CRT_SECURE_NO_WARNINGS /D
 ACE_AS_STATIC_LIBS

 If I don't add the pkg-config output, then all the directories
 included with include-directories appear to be ok:

 /IC:/git-projects/myproject /IC:/git-projects/myproject/component
 /IC:/git-projects/myproject/error
 /IC:/git-projects/myproject/libraries /D _CRT_SECURE_NO_WARNINGS
 /D ACE_AS_STATIC_LIBS

 So the question is, does compile-flags option override all the
 directories included with include_directories? If that's the case,
 then how do I add external include directories through pkg-config? I
 am pretty new at cmake so any help will be appreciated.

Not it shouldn't.
Which version of CMake are you using?

Is the myproject use in this:

 SET_TARGET_PROPERTIES(
myproject PROPERTIES
 COMPILE_FLAGS ${LINKER_FLAGS} )

a target from add_executable() or add_library() or is it
the name of the project used in project() statement?

May be you can give us more information about your CMakeLists.txt.

-- 
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] Does set_target_properties compile_flags option override include_directories?

2011-03-30 Thread Laura Autón García
(sorry I am having troubles receiving the messages from this mailing
list, well I am not receiving anything at all but the confirmation
mails, so I am pasting from the archives)

2011/3/30 Eric Noulard:
 Did you know that there is a FindPkgConfig.cmake module shipped with CMake? 
 It may helps you to use PkgConfig.

That module is used indeed, to find the pkg-config executable file. I
didn't write the macro as I am not the owner of this project, just a
tiny contributor, so I suppose they had their reasons.

 You mean CMake successfully generate the project files right?

Correct. Cmake generates it successfully.

 You did not manage to build your project outside Visual Studio?
If you mean if I have been able to compile the project using any other
tool, no. As Visual Studio usage is compulsory I don't have any other
choice. If Visual Studio is the problem then I have to find any other
way to include external include directories through cmake, not using
compile flags in set_target_properties.

 So the question is, does compile-flags option override all the
 directories included with include_directories? If that's the case,
 then how do I add external include directories through pkg-config? I
 am pretty new at cmake so any help will be appreciated.
 Not it shouldn't. Which version of CMake are you using?

2.8.3

Is the myproject use in this:
 SET_TARGET_PROPERTIES(
myproject PROPERTIES
 COMPILE_FLAGS ${LINKER_FLAGS} )
 a target from add_executable() or add_library() or is it the name of the 
 project used in project() statement?

Yes. I omitted it as I didn't know it had something to do with it:
SET(MYPROJECT_SRCS
  ${Common_SRCS}
  ${Common_HDRS}
  ${MSWIN_SRCS}
  ${MSWIN_HDRS} )

ADD_LIBRARY(myproject ${MYPROJECT_SRCS})
TARGET_LINK_LIBRARIES(myproject ${ACE_LIBRARIES})
SET_TARGET_PROPERTIES(
 myproject PROPERTIES
 COMPILE_FLAGS ${LINKER_FLAGS} )
___
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