[CMake] Does set_target_properties compile_flags option override include_directories?

Laura Autón García laura.auton at gmail.com
Wed Mar 30 07:16:35 EDT 2011


(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} )


More information about the CMake mailing list