Re: [CMake] add_library without source code
Am 27.07.2010 20:01, schrieb Alexander Neundorf: On Tuesday 27 July 2010, Matthias Gwein wrote: Hello! I'm using cmake 2.8.2 and I'd like to build a library of libraries and i have no additional source code. I tried something like that: add_library(mylib ) target_link_libraries(mylib lib1 lib2) But that doesn't work, because add_library needs at least a source file. Is there any way to get that work, without creating a dummy source file? AFAIK no. If you want, you can create that dummy file e.g. with file(WRITE ...), so it doesn't have to go into version control. lib1 and lib2 are shared libs, right ? Alex No they are static libraries. I recognized that i have the same problem with add_executable, there is also at least one source file necessary and i don't like to make dummy files for nothing. But maybe the configuration of my build is unusual for CMake. I've configured them like in my old Make Projects: I organize different software modules in subdirectories, so i have e.g. /modul1/modul1.c /modul1/CMakelists.txt /modul2/modul2.c /modul2/CMakelists.txt /CMakelists.txt The CMakelists is in the project root directory and adds the subdirectories (there are also CMakeLists.txt in the subdirectories) In the Subdirectories, I make libraries (e.g. add_library(modul1 modul1.c)), and in the root directory i'd like to link all libraries to a big library or to a executable. I tried to use add_library only with the library name and too use target_link_libraries to add the libraries of the su-modules, which didn't work. I don't like to have source files in the root directory, so i don't have source files for the commands add_library or add_executable in the root CMakeLists.txt file. How is somethiong like that usually done with CMake? Matthias. ___ 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] Tag Variable
Am 22.04.2010 08:56, schrieb Michael Wild: On 22. Apr, 2010, at 7:52 , Matthias Goesswein wrote: Am 21.04.2010 18:56, schrieb Alexander Neundorf: On Wednesday 21 April 2010, Matthias Goesswein wrote: Hello! My libarian-tool needs a flag before each object file: e.g. libarian -a file1.o -a file2.o -a file3.o library.a CMake provides the tag variable for use within the rule variable of the libarian, but i didn't fond a way to insert the "-a" flags before each object file. Is there any way for doing that? AFAIK no. Please put it as feature request in the bug tracker. What kind of toolchain are you using ? Alex I'd like to use the Softune toolchain (for Fujitsu Microcontrollers), and the librarian can only add object files to an library with the "-a" command line option. All object files must have that flag. It could be done with wrapper shell scripts, but shells are platform specific and so it's for me a no go. It's no problem if you use only one build plattform, but if not so, you would have to write several shell scripts, or add the shell executable for each build plattform. I've already put it in as a feature request yesterday (http://public.kitware.com/Bug/view.php?id=10588) I also want to use Keil Compiler with CMake, but i would also need wrapper scripts for the compiler, librarian and linker, because of the non standard way of command line options. (It uses brackets, something like: cc -o{obj1.o,obj2.o,...}) It would be nice to have the latter approach of my feature request (with regular expressions), because it would be highly customizable. Someone could even change slashes to backslashes, which could be handy if a windows tool is used within cygwin or msys, which requires backslashes (slashes are standard on cygwin or msys). Matthias. You don't have to use shell wrapper scripts. CMake is a portable (rather quirky) scripting language ;-) I often do something like this: add_custom_command(OUTPUT something COMMAND "${CMAKE_COMMAND}" -DSOME=VALUE -P "${CMAKE_CURRENT_BINARY_DIR}/some_configured_script.cmake" DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/some_configured_script.cmake" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" COMMENT "Doing something incredibly smart" VERBATIM ) You can also modify CMAKE__CREATE_STATIC_LIBRARY to suit your needs, perhaps something like this: set(CMAKE_C_CREATE_STATIC_LIBRARY "${CMAKE_COMMAND} -DOBJECTS=\"\" -DLIBRARY=\"\" -P ${CMAKE_BINARY_DIR}/create_archive.cmake") where create_archive.cmake is configured to contain the full path to the librarian tool (using @ONLY) and perhaps with other things. E.g. create_archive.cmake.in might contain (untested): set(ARGS) foreach(o IN LISTS OBJECTS) set(ARGS "${ARGS} -a ${o}") endforeach() set(ARGS "${ARGS} ${LIBRARY}") execute_process( COMMAND "@LIBRARIAN_EXECUTABLE@" ${ARGS} RESULT_VARIABLE RES OUTPUT_VARIABLE OUT ERROR_VARIABLE OUT) if(RES) message(FATAL_ERROR "@LIBRARIAN_EXECUTABLE@ failed to create archive ${LIBRARY}." "The output message was\n" "${OUT}") endif() I tried that, and could get it working. I needed seperate_arguments to get a list of the objects and had to remove the quotes, so that every option was a list element. Otherwise it didn't work. It's not very compfortable (you need a seperate cmake file, and you must be careful with the quotes), but it doesn't depend on the platform and it works. :) Thanks, Matthias. ___ 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] Tag Variable
Am 21.04.2010 18:56, schrieb Alexander Neundorf: On Wednesday 21 April 2010, Matthias Goesswein wrote: Hello! My libarian-tool needs a flag before each object file: e.g. libarian -a file1.o -a file2.o -a file3.o library.a CMake provides the tag variable for use within the rule variable of the libarian, but i didn't fond a way to insert the "-a" flags before each object file. Is there any way for doing that? AFAIK no. Please put it as feature request in the bug tracker. What kind of toolchain are you using ? Alex I'd like to use the Softune toolchain (for Fujitsu Microcontrollers), and the librarian can only add object files to an library with the "-a" command line option. All object files must have that flag. It could be done with wrapper shell scripts, but shells are platform specific and so it's for me a no go. It's no problem if you use only one build plattform, but if not so, you would have to write several shell scripts, or add the shell executable for each build plattform. I've already put it in as a feature request yesterday (http://public.kitware.com/Bug/view.php?id=10588) I also want to use Keil Compiler with CMake, but i would also need wrapper scripts for the compiler, librarian and linker, because of the non standard way of command line options. (It uses brackets, something like: cc -o{obj1.o,obj2.o,...}) It would be nice to have the latter approach of my feature request (with regular expressions), because it would be highly customizable. Someone could even change slashes to backslashes, which could be handy if a windows tool is used within cygwin or msys, which requires backslashes (slashes are standard on cygwin or msys). Matthias. ___ 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] Tag Variable
Hello! My libarian-tool needs a flag before each object file: e.g. libarian -a file1.o -a file2.o -a file3.o library.a CMake provides the tag variable for use within the rule variable of the libarian, but i didn't fond a way to insert the "-a" flags before each object file. Is there any way for doing that? Cheers, Matthias. ___ 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] Slash, Backslash trouble with MSYS and Windows Compiler/Linker
Hello! I`m using the Softune-Compiler under CMake with MSYS on Windows. (I'v e written the Plattform files by myself) The Softune Compiler (For Fujitsu Microcontrollers) requires Backslashes for paths in the options, but Cmake generates slashes as it is usual in MSYS. e.g. The linker must be called: flnk907s -cpu MB90F345 -a -o otuput.abs main.o -l mylibrary\mylibrary.a (it finds the library in the directory mylibrary) but it is called like this flnk907s -cpu MB90F345 -a -o output.abs main.o -l mylibrary/mylibrary.a (it doesn't find the library in the directory mylibrary) Is there any option to change the slashes with cmake to backslashes? --- My Plattform file for the compiler looks like this: MESSAGE(STATUS "Fujitsu_16LX-fcc907s.cmake loaded") # This file implements support for the Softune Compiler SET(CMAKE_STATIC_LIBRARY_PREFIX "") SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a") SET(CMAKE_C_OUTPUT_EXTENSION ".o") SET(CMAKE_EXECUTABLE_SUFFIX ".abs") SET(CMAKE_LINK_LIBRARY_SUFFIX ".a") SET(CMAKE_LINK_LIBRARY_FILE_FLAG "-l") # Default C Flags SET(CMAKE_C_FLAGS_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR}") SET(CMAKE_C_FLAGS_DEBUG_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR} -g -DDEBUG=1") SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR}") SET(CMAKE_C_FLAGS_RELEASE_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR}") SET(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR} -g -DDEBUG=1") # Default Linker Flags SET (CMAKE_EXE_LINKER_FLAGS_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR} -a") SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR} -a -g") SET (CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR} -a") SET (CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR} -a") SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR} -a -g") # Rule variable to compile a single object file SET(CMAKE_C_COMPILE_OBJECT " -o " ) # Rule variable to create a static library SET(CMAKE_C_CREATE_STATIC_LIBRARY "${CMAKE_COMMAND} -E remove " "flib907s -cpu ${CMAKE_SYSTEM_PROCESSOR} -g -a " ) # Rule variable to link a axecutable SET(CMAKE_C_LINK_EXECUTABLE "flnk907s -o " "f2ms -S3 -o .s19 -adjust " ) # not supported SET(CMAKE_C_CREATE_SHARED_LIBRARY "") SET(CMAKE_C_CREATE_MODULE_LIBRARY "") --- Another question: Are such plattform ports welcome in the cmake distribution? If yes, I'll put it in as feature request, when my port is functional. BTW: Are there any naming conventions for new plattforms? Cheers, Matthias. ___ 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] Assembler flag support
Hello! I've submitted the bug report (http://public.kitware.com/Bug/view.php?id=10577) I also added an example project, which uses the gnu assembler, so you could reproduce the problem. Cheers, Matthias. Am 19.04.2010 22:32, schrieb Alexander Neundorf: On Friday 16 April 2010, Matthias Goesswein wrote: Hello! Is there a variable like CMAKE_C_FLAGS_INIT for the assembler available? (e.g. CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT) Did you try this one ? I didn't add any explicit support for that, but I think this should work autoamtically for any language support by cmake (if it doesn't, I'll fix it for ASM). Yes, I tried that. Just for reference, my plattform file looks like this: Can you please post this as a bug in the cmake bug tracker at http://public.kitware.com/Bug ? This way it doesn't get lost. I'll look after it. Thanks 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] Assembler flag support
Hello! Is there a variable like CMAKE_C_FLAGS_INIT for the assembler available? (e.g. CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT) Did you try this one ? I didn't add any explicit support for that, but I think this should work autoamtically for any language support by cmake (if it doesn't, I'll fix it for ASM). Yes, I tried that. Just for reference, my plattform file looks like this: --- MESSAGE(STATUS "Fujitsu_16LX-fasm907s.cmake loaded") SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSION ".s") SET(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION ".o") SET(CMAKE_EXECUTABLE_SUFFIX ".abs") SET(CMAKE_LINK_LIBRARY_SUFFIX ".a") SET(CMAKE_LINK_LIBRARY_FILE_FLAG "-l") SET(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR}") SET(CMAKE_ASM${ASM_DIALECT}_DEBUG_FLAGS_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR} -g") SET(CMAKE_ASM${ASM_DIALECT}_MINSIZEREL_FLAGS_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR}") SET(CMAKE_ASM${ASM_DIALECT}_RELEASE_FLAGS_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR}") SET(CMAKE_ASM${ASM_DIALECT}_RELWITHDEBINFO_FLAGS_INIT "-cpu ${CMAKE_SYSTEM_PROCESSOR} -g") # Rule variable to compile a single object file SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " -o ") # Rule variable to create a static library SET(CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY "${CMAKE_COMMAND} -E remove " "flib907s -cpu ${CMAKE_SYSTEM_PROCESSOR} -g -a ") # Rule variable to link a axecutable SET(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE "flnk907s -o " "f2ms -S3 -o .s19 -adjust ") # not supported SET(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY "") SET(CMAKE_ASM${ASM_DIALECT}_CREATE_MODULE_LIBRARY "") --- Without the -cpu option, the assembler can't assemble a file. So i tried to set the flags within the INIT-Variables, but when i run make (I use MSYS Makefiles), the assembler is called without the -cpu command line option (snipped of the output of make VERBOSE=1): cd /C/Projekte/Software/Gen/Src/Processor && /C/Projekte/Tools/Softune/V30/bin/FASM907S.EXE -I/C/Projekte/Software/Src/Generic -I/C/Projekte/Software/Src/Processor -I/C/Projekte/Software/Src/Main -o CMakeFiles/lib_processor.dir/MB90340.s.o /C/Projekte/Software/Src/Processor/MB90340.s Cheers, Matthias. ___ 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] Assembler flag support
Hello! Is there a variable like CMAKE_C_FLAGS_INIT for the assembler available? (e.g. CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT) Which flags are passed to in the Rule variable for creating an object file from an assembler source: SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " -o ") I'm using CMake 2.8.1. Cheers, Matthias. ___ 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] Different linker-init options depending of the build type
Hello! I'm currently porting to a new platform (Fujitsu LX16 Microcontrollers) and i found following flag-variables: CMAKE_C_FLAGS_INIT CMAKE_C_FLAGS_DEBUG_INIT CMAKE_C_FLAGS_MINSIZEREL_INIT CMAKE_C_FLAGS_RELWITHDEBINFO_INIT But in the Modules which are shipped with CMake i only found CMAKE_EXE_LINKER_FLAGS_INIT as flag variable for the linker. Are CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT ... etc. also possible and working? Another question: Are there any Init-flag-variables for static libraries too? Cheers, Matthias. ___ 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] XCode
Hello! I've noticed that XCode and Kdevelop3 Generators are missing in the documentation, which is online avaliable: http://www.cmake.org/cmake/help/cmake-2-8-docs.html#section_Generators Is the documentation outdated, or is the support for these generators dropped? Cheers, Matthias. ___ 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] Lint Integration
Hi, I´d like to integrate PC-Lint (www.gimpel.com, a source code checker for C/C++) to my cmake build system (Cross-Compile for an embedded Power PC with WindRiver Compiler, which is running on Windows). My first idea was to add a command to CMAKE_C_COMPILE_OBJECT, but I don't know how to extract the include and definition command line options from or .: SET(CMAKE_C_COMPILE_OBJECT " -Wa,-l -o -c " "${PCLINT_EXECUTABLE} +v -iC:\Lint std.lint ) How could i do this (is there a possibility to make string manipulation?), or is there an other way to integrate lint? PC-Lint should check each c-File, which is compiled by the Compiler. Thanks a lot Engineering Center Steyr GmbH & Co KG Geschaeftsfuehrende Gesellschaft: Engineering Center Steyr GmbH Geschaeftsfuehrer der geschaeftsfuehrenden Gesellschaft: Dipl. Ing. Franz Dorfer Sitz der geschaeftsfuehrenden Gesellschaft: 4300 St. Valentin, Oesterreich Firmenbuchgericht: St. Poelten / FN 140816h Sitz der Gesellschaft: 4300 St. Valentin, Steyrer Strasse 32, Oesterreich Firmenbuchgericht: St. Poelten / FN 222001y CONFIDENTIALITY NOTE: This message contains information which may be privileged or confidential, or exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution, retention, archiving, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify us immediately by return e-mail to the sender of this message. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake