[CMake] no space between include path

David Cole david.cole at kitware.com
Wed Oct 4 08:09:42 EDT 2006


INCLUDE_DIRECTORIES does not expect a "-I" in the string. It treats its 
arguments as a CMake list of directory names. It thinks you want a 
directory named "-I/bar" in your CMAKE_CURRENT_SOURCE_DIR...

Try it without the -I.

This...:
-I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include 
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include

...should be passed to INCLUDE_DIRECTORIES like this:
INCLUDE_DIRECTORIES("/usr/include/dbus-1.0;/usr/lib/dbus-1.0/include;/usr/include/glib-2.0;/usr/lib/glib-2.0/include")

...or like this:
INCLUDE_DIRECTORIES("/usr/include/dbus-1.0" "/usr/lib/dbus-1.0/include" 
"/usr/include/glib-2.0" "/usr/lib/glib-2.0/include")


HTH,
David

frederic heem wrote:

>Hi,
>An very simple CMakeLists.txt has been written to show to problem:
>
>project(wireshark C)
>set(CMAKE_VERBOSE_MAKEFILE ON)
>set(dumpcap_FILES
>        capture_opts.c
>)
>include_directories("-I/bar")
>add_executable(dumpcap ${dumpcap_FILES})
>target_link_libraries(dumpcap ${dumpcap_LIBS})
>
>The gcc output is:
>/usr/bin/gcc  -I/home/heefre/software/dbus/wireshark/-I/bar   -o 
>CMakeFiles/dumpcap.dir/capture_opts.o   -c /home/heefre/software/dbus/wireshark/capture_opts.c
>
>For some reason, cmake adds the source path as an include path and doesn't add 
>a space for the next include path.
>
>
>example Alle 09:37, mercoledì 4 ottobre 2006, frederic heem ha scritto:
>  
>
>>Alle 18:39, martedì 3 ottobre 2006, William A. Hoffman ha scritto:
>>    
>>
>>>At 12:28 PM 10/3/2006, frederic heem wrote:
>>>      
>>>
>>>>foreach(PACKAGE ${PACKAGELIST})
>>>>       find_package(${PACKAGE})
>>>>       message(${PACKAGE}_FOUND)
>>>>       if (${PACKAGE}_FOUND)
>>>>               include_directories(${${PACKAGE}_INCLUDE_DIR})
>>>>               set(dumpcap_LIBS ${dumpcap_LIBS}
>>>>${${PACKAGE}_LIBRARIES}) endif (${PACKAGE}_FOUND)
>>>>endforeach(PACKAGE)
>>>>        
>>>>
>>>Try adding a message call inside this if to see what is getting passed
>>>to include_directories.
>>>
>>>Add this before the include_directories call.
>>>message(${${PACKAGE}_INCLUDE_DIR})
>>>      
>>>
>>Here is the output:
>>-I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/glib-2.0
>>-I/usr/lib/glib-2.0/include
>>
>>    
>>
>>>My guess is the value is getting set to a long string of stuff, mostly
>>>likely pkgconfig output that has not been parsed.
>>>      
>>>
>>What operation needs to be done on this string to be passed to the macro
>>include_directories ?
>>
>>    
>>
>>>-Bill
>>>
>>>_______________________________________________
>>>CMake mailing list
>>>CMake at cmake.org
>>>http://www.cmake.org/mailman/listinfo/cmake
>>>      
>>>
>>___________________________________________________________________________
>>___
>>
>>--- NOTICE ---
>>
>>CONFIDENTIALITY - This  email  and  any  attachments  are confidential and
>>are intended  for  the  addressee  only.   If  you  have  received this
>>message by mistake,  please  contact us immediately and then delete the
>>message from your system.  You  must  not copy, distribute, disclose or act
>>upon the contents of this email. Thank you.
>>
>>PERSONAL DATA PROTECTION  (Law  by  Decree  30.06.2003  n. 196) - Personal
>>and corporate  data  submitted  will  be used in a correct, transparent and
>>lawful manner. The data collected will be processed in paper or
>>computerized form for the performance of contractual  and  lawful 
>>obligations  as  well  as for the effective management of business
>>relationship. Data may be disclosed, in Italy or abroad, for the purpose
>>above mentioned to third  parties  which  cooperate with Telsey, agents,
>>banks, factoring companies,  credit recovering companies, credit  insurance
>> companies,  professional  and  consultants,  and   shipping companies. In
>>relation to the same purposes, data  may  be  processed  by  the following 
>>classes  of  executors  or  processors:  management; administration
>>department; logistics  and  purchase  department; sales department; post
>>sales department quality department; R&D department; IT department; legal
>>department. The  data  processor  is  Telsey S.p.A.  The data subject may
>>exercise all the rights set forth in art. 7 of Law by Decree 30.06.2003  n.
>>196 as reported  in in the following link http://www.telsey.it/privacy.jsp.
>>
>>___________________________________________________________________________
>>___ _______________________________________________
>>CMake mailing list
>>CMake at cmake.org
>>http://www.cmake.org/mailman/listinfo/cmake
>>    
>>
>
>
>______________________________________________________________________________
>
>--- NOTICE ---
>
>CONFIDENTIALITY - This  email  and  any  attachments  are confidential and are
>intended  for  the  addressee  only.   If  you  have  received this message by
>mistake,  please  contact us immediately and then delete the message from your
>system.  You  must  not copy, distribute, disclose or act upon the contents of
>this email. Thank you.
>
>PERSONAL DATA PROTECTION  (Law  by  Decree  30.06.2003  n. 196) - Personal and
>corporate  data  submitted  will  be used in a correct, transparent and lawful
>manner. The data collected will be processed in paper or computerized form for
>the performance of contractual  and  lawful  obligations  as  well  as for the
>effective management of business relationship. Data may be disclosed, in Italy
>or abroad, for the purpose above mentioned to third  parties  which  cooperate
>with Telsey, agents, banks, factoring companies,  credit recovering companies,
>credit  insurance  companies,  professional  and  consultants,  and   shipping
>companies. In relation to the same purposes, data  may  be  processed  by  the
>following  classes  of  executors  or  processors:  management; administration
>department; logistics  and  purchase  department; sales department; post sales
>department quality department; R&D department; IT department; legal department.
>The  data  processor  is  Telsey S.p.A.  The data subject may exercise all the
>rights set forth in art. 7 of Law by Decree 30.06.2003  n. 196 as reported  in
>in the following link http://www.telsey.it/privacy.jsp. 
>
>______________________________________________________________________________
>_______________________________________________
>CMake mailing list
>CMake at cmake.org
>http://www.cmake.org/mailman/listinfo/cmake
>
>  
>


More information about the CMake mailing list