[CMake] cmake errror
Hello friends, When running cmake command with a toolchain file I got this error: -- Detecting CXX compiler ABI info - done CMake Error at C:/cygwin/CMake/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCompilerABI.cmake:48 (FILE): file STRINGS file C:/OMAPFlash_Latest/Cmake_OMAPFlash/omapflash/cmake_build/CMakeFiles/CMakeDetermineCompilerABI_CXX.bin cannot be read. Call Stack (most recent call first): C:/cygwin/CMake/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake:64 (CMAKE_DETERMINE_COMPILER_ABI) CMakeLists.txt:2 (project) The toolchain file has the following content: set(CMAKE_SYSTEM_NAME Linux) #specify the cross-compiler set (CMAKE_C_COMPILER /bin/gcc-linux) #set (CMAKE_C_FLAGS -Wall -pedantic -DCOMDRIVER_EXPORTS -DBUILD_FIX_TMP -DFIX_WIN32 -DNO_ZIP -D_DEBUG -D_CONSOLE) set (CMAKE_CXX_COMPILER /bin/g++-linux) set (CMAKE_CXX_FLAGS -Wall -pedantic -DCOMDRIVER_EXPORTS -DBUILD_FIX_TMP -DFIX_WIN32 -D_DEBUG -D_CONSOLE) It actually was working right in one computer, but when installed in another I got this error. I already checked that all the environment is exactly the same, but I don't know where to look now. Can you help me? Thanks Enrique ___ 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] Compiling multiple files, only takes the first one
Hello friends, I have a problem when I try to compile several files, for some reason it takes only the first of the list to build it. It displays a few warnings and at the end the following error: make[2]: *** [CMakeFiles/omap.dir/host/fastboot.c.o] Error 1 make[2]: Leaving directory `/home/x0148488/omapflash/cmake_build' make[1]: *** [CMakeFiles/omap.dir/all] Error 2 make[1]: Leaving directory `/home/x0148488/omapflash/cmake_build' make: *** [all] Error 2 Even before doing the add_executable ( ), I display first the variable that contains the list of files to build, and it indeed has all the files to compile; somehow it only compiles the first one and then leave. Running make with the VERVOSE=1 I can see the command, and it has only the first file of the list; so CMake is generating the command wrong. Can you explain why only one file is compiled and not the entire list? Thanks Enrique ___ 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] Compiling multiple files, only takes the first one
Thank you Eric. The section in the main CMakeLists.txt is as follows: set (FILES ) message (Adding subdirectory host...) include (host/CMakeLists.txt) message (FILES = ${FILES}) foreach (FILE ${FILES}) set (hostFiles ${hostFiles} host/${FILE}) endforeach (FILE) message (hostFiles = ${hostFiles}) add_executable (omap ${comdrvFiles} ${hostFiles}) The hostFiles variable when displayed using the message ( ) shown above shows the following: hostFiles = host/fastboot.c;host/bootimg.c;host/engine.c;host/board_configuration.c;host/bootimg.c;host/engine.c;host/om ap_protocol.c;host/output.c;host/pheriphalboot.c;host/protocol.c;host/usb_linux.c;host/util_linux.c Even so, only compiles host/fastboot.c, which disolays a few warnings and then shows the error described. In the CMakeLIsts.txt file from host/ directory, I only set the FILE variable with the list of files contained in that directory: set(CMAKE_INCLUDE_CURRENT_DIR ON) message (Entering host's CMakeLists) # Add the sources to the host sources Sistem variable: message (Setting /host files, to include them in the build) set(FILES fastboot.c bootimg.c engine.c) set(FILES ${FILES} board_configuration.c bootimg.c engine.c) set(FILES ${FILES} omap_protocol.c output.c pheriphalboot.c protocol.c) set(FILES ${FILES} usb_linux.c util_linux.c) I am working on Windows platform, using Cygwin and doing a Cross-compilation to Linux. I have a Toolchain file that tested before and it is working right. The cmake version is 2.8.3 Thanks a lot Enrique On Mon, Mar 14, 2011 at 2:20 PM, Eric Noulard eric.noul...@gmail.comwrote: 2011/3/14 Enrique Izaguirre enrique.izagui...@gmail.com: Hello friends, I have a problem when I try to compile several files, for some reason it takes only the first of the list to build it. It displays a few warnings and at the end the following error: make[2]: *** [CMakeFiles/omap.dir/host/fastboot.c.o] Error 1 make[2]: Leaving directory `/home/x0148488/omapflash/cmake_build' make[1]: *** [CMakeFiles/omap.dir/all] Error 2 make[1]: Leaving directory `/home/x0148488/omapflash/cmake_build' make: *** [all] Error 2 Even before doing the add_executable ( ), I display first the variable that contains the list of files to build, and it indeed has all the files to compile; somehow it only compiles the first one and then leave. Running make with the VERVOSE=1 I can see the command, and it has only the first file of the list; so CMake is generating the command wrong. Can you explain why only one file is compiled and not the entire list? Looks like some sort of typo. Could you give us the CMakeLists.txt extract with the offending commands? At least the source file list definition and the add_executable statement. and some more info: - platform/host/compiler - cmake version - native or cross-compiling -- 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] Compiling multiple files, only takes the first one
Hi Alex, This is the whole output from the make. I can only see warnings: /bin/gcc-linux -DCOMDRIVER_EXPORTS -DBUILD_FIX_TMP -DFIX_WIN32 -DNO_ZIP -D_DEBUG -D_CONSOLE -I/home/x0148488/omapflash/cmake_build -I/home/x0148488/omapflash -I/home/x0148488/omapflash/comdriver/inc -I/home/x0148488/omapflash/target/src/boot -I/home/x0148488/omapflash/../../../usr/include/LinuxAPI -I/home/x0148488/omapflash/../../../usr/include/OtherLinuxFiles -I/home/x0148488/omapflash/common/inc -Wall -Werror -o CMakeFiles/omap.dir/host/fastboot.c.o -c /home/x0148488/omapflash/host/fastboot.c /home/x0148488/omapflash/host/fastboot.c:125: warning: missing braces around initializer /home/x0148488/omapflash/host/fastboot.c:125: warning: (near initialization for `parity_names[5]') /home/x0148488/omapflash/host/fastboot.c: In function `find_named_value': /home/x0148488/omapflash/host/fastboot.c:206: warning: implicit declaration of function `stricmp' /home/x0148488/omapflash/host/fastboot.c: In function `open_device': /home/x0148488/omapflash/host/fastboot.c:397: warning: unused variable `timeremaining' /home/x0148488/omapflash/host/fastboot.c: In function `offset_and_chip_name': /home/x0148488/omapflash/host/fastboot.c:749: warning: unused variable `addr' /home/x0148488/omapflash/host/fastboot.c: In function `arg': /home/x0148488/omapflash/host/fastboot.c:1143: warning: unused variable `mem_addr' /home/x0148488/omapflash/host/fastboot.c:1201: warning: implicit declaration of function `_snprintf' /home/x0148488/omapflash/host/fastboot.c: At top level: /home/x0148488/omapflash/host/fastboot.c:76: warning: `wipe_data' defined but not used make[2]: *** [CMakeFiles/omap.dir/host/fastboot.c.o] Error 1 make[2]: Leaving directory `/home/x0148488/omapflash/cmake_build' make[1]: *** [CMakeFiles/omap.dir/all] Error 2 make[1]: Leaving directory `/home/x0148488/omapflash/cmake_build' make: *** [all] Error 2 Also the compiler command generated only shows the first file. What could be the problem? Do I have to fix the warnings? Thanks Enrique 2011/3/14 Alexander Neundorf a.neundorf-w...@gmx.net On Monday 14 March 2011, Enrique Izaguirre wrote: Hello friends, I have a problem when I try to compile several files, for some reason it takes only the first of the list to build it. It displays a few warnings and at the end the following error: make[2]: *** [CMakeFiles/omap.dir/host/fastboot.c.o] Error 1 make[2]: Leaving directory `/home/x0148488/omapflash/cmake_build' make[1]: *** [CMakeFiles/omap.dir/all] Error 2 make[1]: Leaving directory `/home/x0148488/omapflash/cmake_build' make: *** [all] Error 2 Even before doing the add_executable ( ), I display first the variable that contains the list of files to build, and it indeed has all the files to compile; somehow it only compiles the first one and then leave. Running make with the VERVOSE=1 I can see the command, and it has only the first file of the list; so CMake is generating the command wrong. No. The files are built one by one after each other. Can you explain why only one file is compiled and not the entire list? Maybe I'm missing something... Isn't the build simply stopping because of a compile error ? You cut away too much from the compiler output, the actual error is not visible in the part above. 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] Compiling multiple files, only takes the first one
Thanks guys. It is doing it right. Best Regards Enrique On Mon, Mar 14, 2011 at 3:22 PM, Enrique Izaguirre enrique.izagui...@gmail.com wrote: OK, I couldn't even imagine that. Really appreciate, I'll make another try. Best Regards Enrique On Mon, Mar 14, 2011 at 3:09 PM, Tyler ty...@cryptio.net wrote: Enrique, I think the -Werror flag is the problem: http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html -Werror Make all warnings into errors. hth, tyler On Mon, Mar 14, 2011 at 2:04 PM, Enrique Izaguirre enrique.izagui...@gmail.com wrote: Hi Alex, This is the whole output from the make. I can only see warnings: /bin/gcc-linux -DCOMDRIVER_EXPORTS -DBUILD_FIX_TMP -DFIX_WIN32 -DNO_ZIP -D_DEBUG -D_CONSOLE -I/home/x0148488/omapflash/cmake_build -I/home/x0148488/omapflash -I/home/x0148488/omapflash/comdriver/inc -I/home/x0148488/omapflash/target/src/boot -I/home/x0148488/omapflash/../../../usr/include/LinuxAPI -I/home/x0148488/omapflash/../../../usr/include/OtherLinuxFiles -I/home/x0148488/omapflash/common/inc -Wall -Werror -o CMakeFiles/omap.dir/host/fastboot.c.o -c /home/x0148488/omapflash/host/fastboot.c /home/x0148488/omapflash/host/fastboot.c:125: warning: missing braces around initializer /home/x0148488/omapflash/host/fastboot.c:125: warning: (near initialization for `parity_names[5]') /home/x0148488/omapflash/host/fastboot.c: In function `find_named_value': /home/x0148488/omapflash/host/fastboot.c:206: warning: implicit declaration of function `stricmp' /home/x0148488/omapflash/host/fastboot.c: In function `open_device': /home/x0148488/omapflash/host/fastboot.c:397: warning: unused variable `timeremaining' /home/x0148488/omapflash/host/fastboot.c: In function `offset_and_chip_name': /home/x0148488/omapflash/host/fastboot.c:749: warning: unused variable `addr' /home/x0148488/omapflash/host/fastboot.c: In function `arg': /home/x0148488/omapflash/host/fastboot.c:1143: warning: unused variable `mem_addr' /home/x0148488/omapflash/host/fastboot.c:1201: warning: implicit declaration of function `_snprintf' /home/x0148488/omapflash/host/fastboot.c: At top level: /home/x0148488/omapflash/host/fastboot.c:76: warning: `wipe_data' defined but not used make[2]: *** [CMakeFiles/omap.dir/host/fastboot.c.o] Error 1 make[2]: Leaving directory `/home/x0148488/omapflash/cmake_build' make[1]: *** [CMakeFiles/omap.dir/all] Error 2 make[1]: Leaving directory `/home/x0148488/omapflash/cmake_build' make: *** [all] Error 2 Also the compiler command generated only shows the first file. What could be the problem? Do I have to fix the warnings? Thanks Enrique 2011/3/14 Alexander Neundorf a.neundorf-w...@gmx.net On Monday 14 March 2011, Enrique Izaguirre wrote: Hello friends, I have a problem when I try to compile several files, for some reason it takes only the first of the list to build it. It displays a few warnings and at the end the following error: make[2]: *** [CMakeFiles/omap.dir/host/fastboot.c.o] Error 1 make[2]: Leaving directory `/home/x0148488/omapflash/cmake_build' make[1]: *** [CMakeFiles/omap.dir/all] Error 2 make[1]: Leaving directory `/home/x0148488/omapflash/cmake_build' make: *** [all] Error 2 Even before doing the add_executable ( ), I display first the variable that contains the list of files to build, and it indeed has all the files to compile; somehow it only compiles the first one and then leave. Running make with the VERVOSE=1 I can see the command, and it has only the first file of the list; so CMake is generating the command wrong. No. The files are built one by one after each other. Can you explain why only one file is compiled and not the entire list? Maybe I'm missing something... Isn't the build simply stopping because of a compile error ? You cut away too much from the compiler output, the actual error is not visible in the part above. 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 ___ 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] make didn't compile
Hello friends, As far as I have been investigating this problem, seems that GNU compilers have a problem when combining -c flag with multiple files and -o flag to generate an executable. The problem is that CMake somehow is generating the compile command, and assembling it wrongly. Is there any way to overcome this issue? Thanks Best Regards Enrique On Wed, Mar 2, 2011 at 10:51 AM, Enrique Izaguirre enrique.izagui...@gmail.com wrote: Thank you Michael, This is the output: /usr/bin/cmake.exe -H/home/x0148488/myprjflash -B/home/x0148488/myprjflash/cmake_build --check-build-system CMakeFiles/Makefile.cmake 0 /usr/bin/cmake.exe -E cmake_progress_start /home/x0148488/myprjflash/cmake_build/CMakeFiles /home/x0148488/myprjflash/cmake_build/CMakeFiles/progress.marks make -f CMakeFiles/Makefile2 all make[1]: Entering directory `/home/x0148488/myprjflash/cmake_build' make -f CMakeFiles/myprj.dir/build.make CMakeFiles/myprj.dir/depend make[2]: Entering directory `/home/x0148488/myprjflash/cmake_build' cd /home/x0148488/myprjflash/cmake_build /usr/bin/cmake.exe -Ecmake_depends Unix Makefiles /home/x0148488/myprjflash /home/x0148488/myprjflash /home/x0148488/myprjflash/cmake_build /home/x0148488/myprjflash/cmake_build /home/x0148488/myprjflash/cmake_build/CMakeFiles/myprj.dir/DependInfo.cmake --color= make[2]: Leaving directory `/home/x0148488/myprjflash/cmake_build' make -f CMakeFiles/myprj.dir/build.make CMakeFiles/myprj.dir/build make[2]: Entering directory `/home/x0148488/myprjflash/cmake_build' /usr/bin/cmake.exe -E cmake_progress_report /home/x0148488/myprjflash/cmake_build/CMakeFiles 1 [ 12%] Building CXX object CMakeFiles/myprj.dir/comdriver/src/StdAfx.cpp.o /bin/g++-linux -D_BSD_SOURCE -DWIN32 -D_DEBUG -D_CONSOLE -D_CRT_SECURE_NO_WARNINGS -DNO_ZIP -I/home/x0148488/myprjflash /cmake_build -I/home/x0148488/myprjflash -I/home/x0148488/myprjflash/common/inc -I/home/x0148488/myprjflash/../inc -I/home/ x0148488/myprjflash/target/src/boot -IC:/Program /Files/Microsoft /SDKs/Windows/v6.0A/Include -I/usr/include/w32api - Wall -pedantic -Werror -o CMakeFiles/myprj.dir/comdriver/src/StdAfx.cpp.o -c /home/x0148488/myprjflash/comdriver/src/StdAf x.cpp i686-unknown-linux-gnu-g++: cannot specify -o with -c or -S and multiple compilations make[2]: *** [CMakeFiles/myprj.dir/comdriver/src/StdAfx.cpp.o] Error 1 make[2]: Leaving directory `/home/x0148488/myprjflash/cmake_build' make[1]: *** [CMakeFiles/myprj.dir/all] Error 2 make[1]: Leaving directory `/home/x0148488/myprjflash/cmake_build' make: *** [all] Error 2 Thanks Enrique On Wed, Mar 2, 2011 at 10:37 AM, Michael Wild them...@gmail.com wrote: On 03/02/2011 05:33 PM, Enrique Izaguirre wrote: Hello friends, I have another problem with my build. I run Cmake and complete the building and production of a Makefile. But when I run make I get the following result: i686-unknown-linux-gnu-g++: cannot specify -o with -c or -S and multiple compilations make[2]: *** [CMakeFiles/myprj.dir/comdriver/src/StdAfx.cpp.o] Error 1 make[1]: *** [CMakeFiles/myprj.dir/all] Error 2 make: *** [all] Error 2 What I'm doing in the CMakeLists.txt is to get all the programs from one subdirectory and put them in variable comdrvFiles, which has everything from that subdirectory: comdrvFiles = comdriver/src/StdAfx.cpp;comdriver/src/ComDriver.cpp;comdriver/src/PortEnumerator.cpp;comdriver/src/serial driver.cpp;comdriver/src/usbdriver.cpp and then collect all the programs from another subdirectory in variable hostFiles: hostFiles = host/fastboot.c;host/bootimg.c;host/engine.c once that I have all the programs collected in those variables I do the following: add_executable (myprj ${comdrvFiles} ${hostFiles}) to create an executable named myprj I don't have any program in the main directory, only the main CMakeLists.txt and in main directory is where I collect everything and try to produce an executable. Is there something missing? How can I produce an executable? Thanks in advance BR Enrique Can you show the output of make VERBOSE=1? 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 ___ 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] Function and list
As far as I know, you have to use foreach( ) to print element by element in the list. BR Enrique On Wed, Mar 2, 2011 at 8:52 AM, Anton Sibilev anton.sibi...@gmail.comwrote: Hello! I have a function like FUNCTION (MY_FUNC list) MESSAGE (..${list}) ENDFUNCTION () And I call it like: SET (list 11 22 33 44 55) MY_FUNC (list) and output is: ..11 How I can work with lists or unknown number of arguments in functions? ___ 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
[CMake] make didn't compile
Hello friends, I have another problem with my build. I run Cmake and complete the building and production of a Makefile. But when I run make I get the following result: i686-unknown-linux-gnu-g++: cannot specify -o with -c or -S and multiple compilations make[2]: *** [CMakeFiles/myprj.dir/comdriver/src/StdAfx.cpp.o] Error 1 make[1]: *** [CMakeFiles/myprj.dir/all] Error 2 make: *** [all] Error 2 What I'm doing in the CMakeLists.txt is to get all the programs from one subdirectory and put them in variable comdrvFiles, which has everything from that subdirectory: comdrvFiles = comdriver/src/StdAfx.cpp;comdriver/src/ComDriver.cpp;comdriver/src/PortEnumerator.cpp;comdriver/src/serial driver.cpp;comdriver/src/usbdriver.cpp and then collect all the programs from another subdirectory in variable hostFiles: hostFiles = host/fastboot.c;host/bootimg.c;host/engine.c once that I have all the programs collected in those variables I do the following: add_executable (myprj ${comdrvFiles} ${hostFiles}) to create an executable named myprj I don't have any program in the main directory, only the main CMakeLists.txt and in main directory is where I collect everything and try to produce an executable. Is there something missing? How can I produce an executable? Thanks in advance BR Enrique ___ 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] Including a header file fails
Thank you very much for your help. The header file is already #included in one of the source files. What I don't know is how to link it. Can I do it only with target_link_libraries ( ) or how? Thanks Enrique On Mon, Feb 28, 2011 at 5:26 PM, Andreas Pakulat ap...@gmx.de wrote: On 28.02.11 16:55:12, Enrique Izaguirre wrote: Hello, I am trying to include a windows header file in my build. The simplest way I found is to add the following in the main CMakeLists.txt file: include_directories (${MYPRJ_SOURCE_DIR}/../../../usr/include/w32api) add_library (w32api w32api/winbase.h) add_executable (myprj ${hostFiles}) target_link_libraries (myprj w32api) I am working in Cygwin, and my project is in /home/my-user/myprj, that's why I am using ${MYPRJ_SOURCE_DIR}/../../../usr/include/w32api since / is the root in my cygwin system and the file I want is in /usr/include/w32api but when running cmake I get the following error: CMake Error in CMakeLists.txt: Cannot find source file winbase.h. Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx I have not been able to find out what is going on. Could you help please? There are several errors here: 1. you already added the w32api directory to the include-dirs, so you don't need it in the add_library line 2. you're trying to build a library from a header file 3. you're adding files that are not part of your source code to your targets 4. you're trying to link an executable against that header file, what you really want is #include the header file in your sources and link to whatever library provides the implementation for winbase.h If you fix 4. you won't need to fix 1-3. Andreas ___ 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] Including a header file fails
Hello again, I tried several ways but I cannot make it work. The only thing I need to do is to add a folder which contains a windows header file, in order that it be included in the build. There must be a simple way to do it. Could you help? Maybe if you have an example or something similar. Thanks Enrique On Tue, Mar 1, 2011 at 1:20 PM, Enrique Izaguirre enrique.izagui...@gmail.com wrote: Thank you very much. I'll try that. Best Regards Enrique On Tue, Mar 1, 2011 at 1:18 PM, John Drescher dresche...@gmail.comwrote: On Tue, Mar 1, 2011 at 2:15 PM, Enrique Izaguirre enrique.izagui...@gmail.com wrote: Sorry, I didn't explain correctly. All the source files are in variable ${hostFiles} and I generated and executable using add_executable (myprj ${hostFiles}) now I need to add the w32api folder from Windows, which has header files called from one of the source files contained in ${hostFiles} and are located in ${MYPRJ_SOURCE_DIR}/../../../usr/include/w32api How can I do this? You add the appropriate include_directories() command in CMake. If that header requires linking to a Microsoft library then you do add the Microsoft library to the target_link_libraries not the header file. John ___ 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] Including a header file fails
Hello, I have a program called fastboot.c which #includes util_windows.h which #includes windows.h which finally #includes winbase.h where all the constants are defined. The errors I get are because the Makefile I got from CMake, doesn't find the constants, as shown: /host/fastboot.h:101: warning: ISO C does not allow extra `;' outside of a functi /host/fastboot.c:93: error: `NOPARITY' undeclared here (not in a function) /host/fastboot.c:112: error: `NOPARITY' undeclared here (not in a function) /host/fastboot.c:112: error: initializer element is not constant /host/fastboot.c:112: error: (near initialization for `parity_names[0].value') /host/fastboot.c:112: error: initializer element is not constant /host/fastboot.c:112: error: (near initialization for `parity_names[0]') /host/fastboot.c:113: error: `ODDPARITY' undeclared here (not in a function) /host/fastboot.c:113: error: initializer element is not constant /host/fastboot.c:113: error: (near initialization for `parity_names[1].value') /host/fastboot.c:113: error: initializer element is not constant /host/fastboot.c:113: error: (near initialization for `parity_names[1]') /host/fastboot.c:114: error: `EVENPARITY' undeclared here (not in a function) /host/fastboot.c:114: error: initializer element is not constant /host/fastboot.c:114: error: (near initialization for `parity_names[2].value') /host/fastboot.c:114: error: initializer element is not constant /host/fastboot.c:114: error: (near initialization for `parity_names[2]') /host/fastboot.c:115: error: `MARKPARITY' undeclared here (not in a function) /host/fastboot.c:115: error: initializer element is not constant /host/fastboot.c:115: error: (near initialization for `parity_names[3].value') /host/fastboot.c:115: error: initializer element is not constant /host/fastboot.c:115: error: (near initialization for `parity_names[3]') /host/fastboot.c:116: error: `SPACEPARITY' undeclared here (not in a function) /host/fastboot.c:116: error: initializer element is not constant /host/fastboot.c:116: error: (near initialization for `parity_names[4].value') /host/fastboot.c:116: error: initializer element is not constant /host/fastboot.c:116: error: (near initialization for `parity_names[4]') /host/fastboot.c:118: warning: missing braces around initializer /host/fastboot.c:118: warning: (near initialization for `parity_names[5]') /host/fastboot.c:118: error: initializer element is not constant /host/fastboot.c:118: error: (near initialization for `parity_names[5]') /host/fastboot.c: In function `find_named_value': /host/fastboot.c:125: warning: implicit declaration of function `stricmp' /host/fastboot.c: In function `open_device_callback': /host/fastboot.c:302: warning: implicit declaration of function `sleepms' /host/fastboot.c: In function `open_device': /host/fastboot.c:313: warning: unused variable `timeremaining' /host/fastboot.c: In function `usage': /host/fastboot.c:382: warning: string length `2787' is greater than the length `5 upport /host/fastboot.c: In function `offset_and_chip_name': /host/fastboot.c:729: warning: unused variable `addr' /host/fastboot.c: In function `arg': /host/fastboot.c:845: error: `EVENPARITY' undeclared (first use in this function) /host/fastboot.c:845: error: (Each undeclared identifier is reported only once /host/fastboot.c:845: error: for each function it appears in.) /host/fastboot.c:848: error: `NOPARITY' undeclared (first use in this function) All those constants as mentioned are in winbase.h how can I say CMake where to look? I used include_directories ( ) and it didn't work. Also: util_windows.h is in the same directory as fastboot.c windows.h and winbase.h are in ${MYPRJ_SOURCE_DIR}/../../../usr/include/w32api which is the one I tried to include inside include_directories ( ) Thanks a lot Enrique On Tue, Mar 1, 2011 at 5:03 PM, Andreas Pakulat ap...@gmx.de wrote: On 01.03.11 14:58:15, Enrique Izaguirre wrote: I tried several ways but I cannot make it work. The only thing I need to do is to add a folder which contains a windows header file, in order that it be included in the build. There must be a simple way to do it. Could you help? Header files are not included into the build, they are included in a cpp source file and that cpp file is then added to the build into an add_executable call. Once you have that and if it gives you errors, post the complete error messages here. Andreas ___ 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
[CMake] Including a header file fails
Hello, I am trying to include a windows header file in my build. The simplest way I found is to add the following in the main CMakeLists.txt file: include_directories (${MYPRJ_SOURCE_DIR}/../../../usr/include/w32api) add_library (w32api w32api/winbase.h) add_executable (myprj ${hostFiles}) target_link_libraries (myprj w32api) I am working in Cygwin, and my project is in /home/my-user/myprj, that's why I am using ${MYPRJ_SOURCE_DIR}/../../../usr/include/w32api since / is the root in my cygwin system and the file I want is in /usr/include/w32api but when running cmake I get the following error: CMake Error in CMakeLists.txt: Cannot find source file winbase.h. Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx I have not been able to find out what is going on. Could you help please? Best Regards Enrique ___ 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] Problem with add_executable ( )
Hello friends, I have a problem when running cmake command, the add_executable ( ) is giving me an error which I cannot see what is the problem. I have in my main CMakeLists.txt files the following section: == include (host/CMakeLists.txt) foreach (FILE ${FILES}) set (hostFiles ${hostFiles} host/${FILE}) endforeach (FILE) add_executable (mainprog ${hostFiles}) == After running the cmake command I got the following error: Adding subdirectory host... Entering host's CMakeLists CMake Error at CMakeLists.txt:82 (add_executable): add_executable called with incorrect number of arguments My understanding is that add_executable can take from 2 arguments, is this correct? As shown above, I have in host/ subdirectory a CMakeLists.txt file with the following: set(CMAKE_INCLUDE_CURRENT_DIR ON) message (Entering host's CMakeLists) and that's it. What could be the problem? Thanks Best Regards Enrique ___ 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] Problem with add_executable ( )
Thank you Andreas, Yes, it is empty, but I tried now creating FILES this way before the foreach: set (FILES ) and still got the same result. Is this way OK to create an empty variable? Thanks Enrique On Thu, Feb 17, 2011 at 2:02 PM, Andreas Pakulat ap...@gmx.de wrote: On 17.02.11 12:39:36, Enrique Izaguirre wrote: Hello friends, I have a problem when running cmake command, the add_executable ( ) is giving me an error which I cannot see what is the problem. I have in my main CMakeLists.txt files the following section: == include (host/CMakeLists.txt) foreach (FILE ${FILES}) set (hostFiles ${hostFiles} host/${FILE}) endforeach (FILE) add_executable (mainprog ${hostFiles}) == After running the cmake command I got the following error: Adding subdirectory host... Entering host's CMakeLists CMake Error at CMakeLists.txt:82 (add_executable): add_executable called with incorrect number of arguments My understanding is that add_executable can take from 2 arguments, is this correct? As shown above, I have in host/ subdirectory a CMakeLists.txt file with the following: set(CMAKE_INCLUDE_CURRENT_DIR ON) message (Entering host's CMakeLists) and that's it. What could be the problem? You do not supply enough arguments to add_executable. Check what the value of ${hostFiles} is by using message(). I bet its empty given that you don't create FILES variable anywhere. Andreas -- You've been leading a dog's life. Stay off the furniture. ___ 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] Problem with add_executable ( )
OK, I got it. The example I saw in the book is also without defining FILES. Then I have to set it to an initial value, that should be the path where the files are, right? Than you very much. Best Regards Enrique On Thu, Feb 17, 2011 at 2:55 PM, Andreas Pakulat ap...@gmx.de wrote: On 17.02.11 14:28:21, Enrique Izaguirre wrote: Thank you Andreas, Yes, it is empty, but I tried now creating FILES this way before the foreach: set (FILES ) and still got the same result. Is this way OK to create an empty variable? You don't understand the problem, as long as FILES is empty, the foreach() loop will not run and hence your hostFiles variable will not be set. add_executable needs _at least_ 2 arguments, the name of the target and at least one source file. You only supply 1 argument, the target name, because your cmake variable is empty (or not set at all). You need to supply actual source files. Andreas -- You own a dog, but you can only feed a cat. ___ 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] Problem with add_executable ( )
Thank you very much Andreas, I did it and it worked. Really appreciated your help. Best Regards Enrique On Thu, Feb 17, 2011 at 4:54 PM, Andreas Pakulat ap...@gmx.de wrote: On 17.02.11 15:12:28, Enrique Izaguirre wrote: OK, I got it. The example I saw in the book is also without defining FILES. Then I have to set it to an initial value, that should be the path where the files are, right? Yes usually you setup a variable with the relative path to the sources of the target. I don't know what book you're reading but this simple usecase usually looks like this: set( MYEXEC_SRCS main.cpp subdir1/foo.cpp subdir2/bar.cpp baz.cpp ) add_executable( myexec ${MYEXEC_SRCS} ) Andreas -- You possess a mind not merely twisted, but actually sprained. ___ 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
[CMake] CMake Error: Error required internal CMake variable not set
Hello again, I am trying to cross-compile from Windows (actually Cygwin) to Linux. My Toolchain file (Toolchain-linuxcpp.cmake) is as follows: SET(CMAKE_SYSTEM_NAME Linux) #specify the cross-compiler set (CMAKE_C_COMPILER /bin/gcc-linux) set (CMAKE_CXX_COMPILER /bin/g++-linux) After doing the cmake build using cmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain-linuxcpp.cmake .. CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. Missing variable is: CMAKE_C_LINK_EXECUTABLE I have using both compilers separately and I didn't have any problem, but when I put them together in the Toolchain file is when this problems comes up. What value CMAKE_C_LINK_EXECUTABLE variable should be set? And where? Thanks in advance Best Regards Enrique ___ 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] CMake Error: Error required internal CMake variable not set
Thanks Alexander, Seems that it doesn't have much information but here it is: # cmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain-linuxcpp.cmake .. System name is: Linux The Top directory is: /home/x0148488/omapflash Adding subdirectory comdriver... Entering comdriver's CMakeLists Now trying to find AdbWinApi.lib library Adding subdirectory common... Adding subdirectory host... -- Configuring done CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. Missing variable is: CMAKE_C_LINK_EXECUTABLE -- Generating done -- Build files have been written to: /home/x0148488/omapflash/cmake_build Thanks Enrique 2011/2/4 Alexander Neundorf a.neundorf-w...@gmx.net On Friday 04 February 2011, Enrique Izaguirre wrote: Hello again, I am trying to cross-compile from Windows (actually Cygwin) to Linux. My Toolchain file (Toolchain-linuxcpp.cmake) is as follows: SET(CMAKE_SYSTEM_NAME Linux) #specify the cross-compiler set (CMAKE_C_COMPILER /bin/gcc-linux) set (CMAKE_CXX_COMPILER /bin/g++-linux) After doing the cmake build using cmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain-linuxcpp.cmake .. CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. Missing variable is: CMAKE_C_LINK_EXECUTABLE I have using both compilers separately and I didn't have any problem, but when I put them together in the Toolchain file is when this problems comes up. What value CMAKE_C_LINK_EXECUTABLE variable should be set? And where? This should be set via CMakeCInformation.cmake, which loads the platform- and compiler specific files, e.g. Modules/Compiler/GNU-C.cmake. Can you please post the output of the cmake run ? 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
[CMake] Executable in the main directory
Hello, Is it possible to create an executable in your top directory if you don't have there any program? I mean, if all your programs .c and .cpp are in subdirectories contained in your top directory, each one with its own CMakeLists.txt. I have three subdirectories, and all my programs are in these subdirectories. I don't have any in my main directory, but the executable should be created in the main directoy. Is it possible? How? Thanks BR Enrique ___ 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] Executable in the main directory
Thanks a lot Eric Actually I am trying to move a project already done to CMake, and it doesn't have any executable in the top directory, it is now done in Windows under Visual Studio. In the top directory I have a CMakeLists,txt that calls each one of the subdirectories in which I have also their respective CMakeLIsts.txt. But I don't know at the end how to put everything together in an executable. Because each directory compiles independently, like a module. I don't know how it is done in Visual Studio. Thanks again Enrique On Wed, Feb 2, 2011 at 3:42 PM, Eric Noulard eric.noul...@gmail.com wrote: 2011/2/2 Enrique Izaguirre enrique.izagui...@gmail.com: Hello, Is it possible to create an executable in your top directory if you don't have there any program? I mean, if all your programs .c and .cpp are in subdirectories contained in your top directory, each one with its own CMakeLists.txt. I have three subdirectories, and all my programs are in these subdirectories. I don't have any in my main directory, but the executable should be created in the main directoy. Is it possible? How? Yes you can. You can control the output directory for executable/library using EXECUTABLE_OUTPUT_PATH and/or LIBRARY_OUTPUT_PATH see; http://www.cmake.org/Wiki/CMake_Useful_Variables From your question, I think you may be trying to do something that is not in the CMake-way-of-building. First of all using CMake ones tends to suggest to build 'out-of-tree': http://www.cmake.org/Wiki/CMake_FAQ#Out-of-source_build_trees Then do you need your executables in the top dir for devel purpose or something else? -- 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
[CMake] CMake Error: Error required internal CMake variable not set, ...
Hello, I am new to CMake and following a few examples, I am now trying to cross-compile a C++ program from Cygwin to Linux, and I got the following errors: CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. Missing variable is: CMAKE_C++_COMPILER_ENV_VAR CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. Missing variable is: CMAKE_C++_COMPILER : I have a folder named helloC++-linux, where I have all my stuff: A simple hello.cpp program My CMakeLists.txt contains: #CMakeLists.txt : CMake configuration file PROJECT(helloC++-linux C++) #States that CMake required version must be = 2.6 CMAKE_MINIMUM_REQUIRED(VERSION 2.6) #File to build and executable: ADD_EXECUTABLE(hello.o hello.cpp) My Toolchain file (named Toolchain-linuxcpp.cmake) contains: INCLUDE (CMakeForceCompiler) SET(CMAKE_SYSTEM_NAME Linux) #specify the cross-compiler SET(CMAKE_CXX_COMPILER /bin/g++-linux) and I tried to build it using following command: cmake -DCMAKE_TOOLACHAIN_FILE=./Toolchain-linuxcpp.cmake . Before this, I tried it compiling a simple C program, using gcc-linux compiler and setting CMAKE_C_COMPILER variable, and it worked correctly, but once that I am trying to do it with C++ I got these errors. I couldn't find anything about this on the web. Could you help me please? Thanks Enrique ___ 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] Still have a problem to cross-compile a simple C++ program
Hello again: For some reason when I try to compile a simple C++ program, it takes the wrong compiler, even though I am setting the appropriate one in the Toolchain file; I am working on Cygwin, and I am trying to compile for a LInux environment using g++-linux compiler, which I tested it and works correctly. I have a folder named helloC++-linux, where I have all my stuff: A simple hello.cpp program My CMakeLists.txt contains: #CMakeLists.txt : CMake configuration file PROJECT(helloC++-linux CXX) #States that CMake required version must be = 2.6 CMAKE_MINIMUM_REQUIRED(VERSION 2.6) #File to build and executable: ADD_EXECUTABLE(hello.o hello.cpp) My Toolchain file (named Toolchain-linuxcpp.cmake) contains: SET(CMAKE_SYSTEM_NAME Linux) #specify the cross-compiler SET(CMAKE_CXX_COMPILER /bin/g++-linux) and I tried to build it using following command: cmake -DCMAKE_TOOLACHAIN_FILE=./Toolchain-linuxcpp.cmake . But when building, CMake looks for a compiler, and takes /usr/bin/c++.exe instead of /bin/g++-linux. I tried also using CMAKE_FORCE_CXX_COMPILER, but I got the same results. Is there any way of make it take the compiler from /bin, instead of from /usr/bin ? Thanks Best Regards Enrique ___ 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