From bagautham at yahoo.com Fri Nov 1 02:23:32 2019 From: bagautham at yahoo.com (Gautham B A) Date: Fri, 1 Nov 2019 11:53:32 +0530 Subject: [CMake] CMake variable to set stack size Message-ID: Hi, Is there a CMake variable to set the stack size of a target? Upon searching the issues, I came across this one - https://gitlab.kitware.com/cmake/cmake/issues/17572 . It says that there is a CMake variable CMAKE_CXX_STACK_SIZE, but it isn?t clear whether CMAKE_CXX_STACK_SIZE can be used. Further, the CMake documentation doesn?t seem to have anything on CMAKE_CXX_STACK_SIZE - https://cmake.org/cmake/help/v3.16/search.html?q=CMAKE_CXX_STACK_SIZE&check_keywords=yes&area=default I?ve managed to set the stack size by setting the linker flag based on the compiler ? if (MSVC) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:10000000") else () set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--stack,10000000") endif() Having a CMake variable to set the stack size would greatly simplify things. Could anybody please give more info on this? Thanks, --Gautham -------------- next part -------------- An HTML attachment was scrubbed... URL: From s-morris at n-eos.com Fri Nov 1 06:02:01 2019 From: s-morris at n-eos.com (Stephen Morris) Date: Fri, 1 Nov 2019 10:02:01 +0000 Subject: [CMake] Accessing -fPIC and -std settings within CMake definitions Message-ID: I'm setting up a custom build step to build a precompiled header in gcc (yes I know that native support is coming with CMake 3.16, but I need to get something working on an older version). My approach is basically to set up a custom command thus: set_target_properties(mytarget PRIVATE CXX_STANDARD 17) set_target_properties(mytarget PRIVATE POSITION_INDEPENDENT CODE_1) set(CMAKE_VERBOSE_MAKEFILE TRUE) ... ... set(CXX_FLAGS ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}) .. or whatever, depending on the current configuration.. get_target_property(compile_options, mytarget, COMPILE_OPTIONS) add_custom_command(OUTPUT myheader.h.gch COMMAND ${CMAKE_CXX_COMPILER} ${CXX_FLAGS} ${compile_options} -fPIC -std=gnu++17 -c myheader.h -o myheader.h.gch DEPENDS myheader.h) add_custom_target(BuildMyPCH DEPENDS myheader.h.gch) add_dependencies(mytarget, BuildMyPCH) You'll note that in my custom command I've had to specify -fPIC and -std-gnu++17 explicitly, because they aren't included among either CXX_FLAGS or COMPILE_OPTIONS. I've looked for them among the COMPILE_DEFINITIONS, COMPILE_FEATURES and COMPILE_FLAGS properties of my target as well, but there's no sign of them. And yet if I look at the verbose output when gcc builds other files using the CMake-generated makefile, I see that they are being included automatically. So, my question: where is CMake storing these settings, and how can I apply them in my custom command without having to do so manually? From s-morris at n-eos.com Fri Nov 1 12:24:03 2019 From: s-morris at n-eos.com (Stephen Morris) Date: Fri, 1 Nov 2019 16:24:03 +0000 Subject: [CMake] Stray backslash appearing when CMAKE_CXX_FLAGS_RELEASE used in custom command Message-ID: On 1 November at 10:02, Stephen Morris wrote: > My approach is basically to set up a custom command thus: > set(CXX_FLAGS ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}) .. or whatever, depending on the current configuration.. > get_target_property(compile_options, mytarget, COMPILE_OPTIONS) add_custom_command(OUTPUT myheader.h.gch > COMMAND ${CMAKE_CXX_COMPILER} ${CXX_FLAGS} ${compile_options} -fPIC -std=gnu++17 -c myheader.h -o myheader.h.gch > DEPENDS myheader.h) add_custom_target(BuildMyPCH > DEPENDS myheader.h.gch) add_dependencies(mytarget, BuildMyPCH) My earlier question still stands, but at the time I wrote it I had only tested it for Debug builds where ${CMAKE_CXX_FLAGS_DEBUG} consisted of a single item, '-g'. I've since tried doing the same thing for a Release build, and this failed because ${CMAKE_CXX_FLAGS_RELEASE} has two items, '-O3 -DNDEBUG'. When the custom command is executed, this somehow becomes "-O3\ -DNDEBUG" on the command line, and the presence of the stray backslash causes the compilation to fail with the message, "cc1plus: error: argument to '-O' should be a non-negative integer. 'g', 's' or 'fast'" So why isn't the cmake variable placed properly onto the command line, and what can I do to prevent this behaviour? From nt_mahmood at yahoo.com Sat Nov 2 09:35:52 2019 From: nt_mahmood at yahoo.com (Mahmood Naderan) Date: Sat, 2 Nov 2019 13:35:52 +0000 (UTC) Subject: [CMake] Issue with non-system gcc path References: <1275500301.128901.1572701752683.ref@mail.yahoo.com> Message-ID: <1275500301.128901.1572701752683@mail.yahoo.com> Hi, May I know what is wrong with the specifying a non-system gcc path? $ cmake .. -DCMAKE_C_COMPILER=/storage/users/mnaderan/tools/gcc-6.1.0/bin/gcc -DCMAKE_CXX_COMPILER=/storage/users/mnaderan/tools/gcc-6.1.0/bin/g++?????????????????????????????????? -- The C compiler identification is unknown -- The CXX compiler identification is unknown -- Check for working C compiler: /storage/users/mnaderan/tools/gcc-6.1.0/bin/gcc -- Check for working C compiler: /storage/users/mnaderan/tools/gcc-6.1.0/bin/gcc -- broken CMake Error at /storage/users/mnaderan/tools/cmake-3.15.4/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message): ? The C compiler ??? "/storage/users/mnaderan/tools/gcc-6.1.0/bin/gcc" ? is not able to compile a simple test program. ? It fails with the following output: Regards, Mahmood -------------- next part -------------- An HTML attachment was scrubbed... URL: From rainer.poisel at gmail.com Sat Nov 2 09:53:52 2019 From: rainer.poisel at gmail.com (Rainer Poisel) Date: Sat, 2 Nov 2019 14:53:52 +0100 Subject: [CMake] Issue with non-system gcc path In-Reply-To: <1275500301.128901.1572701752683@mail.yahoo.com> References: <1275500301.128901.1572701752683.ref@mail.yahoo.com> <1275500301.128901.1572701752683@mail.yahoo.com> Message-ID: Hi Mahmood, I think there is a problem with your toolchain. Maybe there is an environment variable (hot guess: LD_LIBRARY_PATH or something similar) missing. Have a look into the following files in your build directory: * CMakeFiles/CMakeOutput.log and * CMakeFiles/CMakeError.log Maybe there is some helpful information there? Best regards, Rainer On Sat, Nov 2, 2019 at 2:36 PM Mahmood Naderan via CMake wrote: > > Hi, > > May I know what is wrong with the specifying a non-system gcc path? > > > $ cmake .. -DCMAKE_C_COMPILER=/storage/users/mnaderan/tools/gcc-6.1.0/bin/gcc -DCMAKE_CXX_COMPILER=/storage/users/mnaderan/tools/gcc-6.1.0/bin/g++ -- The C compiler identification is unknown > -- The CXX compiler identification is unknown > -- Check for working C compiler: /storage/users/mnaderan/tools/gcc-6.1.0/bin/gcc > -- Check for working C compiler: /storage/users/mnaderan/tools/gcc-6.1.0/bin/gcc -- broken > CMake Error at /storage/users/mnaderan/tools/cmake-3.15.4/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message): > The C compiler > > "/storage/users/mnaderan/tools/gcc-6.1.0/bin/gcc" > > is not able to compile a simple test program. > > It fails with the following output: > > > > > Regards, > Mahmood > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > https://cmake.org/mailman/listinfo/cmake From nt_mahmood at yahoo.com Sat Nov 2 15:56:17 2019 From: nt_mahmood at yahoo.com (Mahmood Naderan) Date: Sat, 2 Nov 2019 19:56:17 +0000 (UTC) Subject: [CMake] Issue with non-system gcc path In-Reply-To: References: <1275500301.128901.1572701752683.ref@mail.yahoo.com> <1275500301.128901.1572701752683@mail.yahoo.com> Message-ID: <1757814362.202919.1572724577567@mail.yahoo.com> OK. The OS is centos-6.9 which is pretty old. I think I may hit other errors later.I will try to find another way. Thank you. Regards, Mahmood On Saturday, November 2, 2019, 5:24:05 PM GMT+3:30, Rainer Poisel wrote: Hi Mahmood, I think there is a problem with your toolchain. Maybe there is an environment variable (hot guess: LD_LIBRARY_PATH or something similar) missing. Have a look into the following files in your build directory: ? * CMakeFiles/CMakeOutput.log and ? * CMakeFiles/CMakeError.log Maybe there is some helpful information there? Best regards, ? Rainer On Sat, Nov 2, 2019 at 2:36 PM Mahmood Naderan via CMake wrote: > > Hi, > > May I know what is wrong with the specifying a non-system gcc path? > > > $ cmake .. -DCMAKE_C_COMPILER=/storage/users/mnaderan/tools/gcc-6.1.0/bin/gcc -DCMAKE_CXX_COMPILER=/storage/users/mnaderan/tools/gcc-6.1.0/bin/g++? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? -- The C compiler identification is unknown > -- The CXX compiler identification is unknown > -- Check for working C compiler: /storage/users/mnaderan/tools/gcc-6.1.0/bin/gcc > -- Check for working C compiler: /storage/users/mnaderan/tools/gcc-6.1.0/bin/gcc -- broken > CMake Error at /storage/users/mnaderan/tools/cmake-3.15.4/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message): >? The C compiler > >? ? "/storage/users/mnaderan/tools/gcc-6.1.0/bin/gcc" > >? is not able to compile a simple test program. > >? It fails with the following output: > > > > > Regards, > Mahmood > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > https://cmake.org/mailman/listinfo/cmake -------------- next part -------------- An HTML attachment was scrubbed... URL: From doenges at mvtec.com Mon Nov 4 02:12:02 2019 From: doenges at mvtec.com (Eric Doenges) Date: Mon, 4 Nov 2019 08:12:02 +0100 Subject: [CMake] Accessing -fPIC and -std settings within CMake definitions In-Reply-To: References: Message-ID: <6a1eb89e-71c1-cec9-48dd-19b347aa53ae@mvtec.com> Am 01.11.19 um 11:02 schrieb Stephen Morris: > I'm setting up a custom build step to build a precompiled header in gcc (yes I know that native support is coming with CMake 3.16, but I need to get something working on an older version). > > My approach is basically to set up a custom command thus: > > set_target_properties(mytarget PRIVATE CXX_STANDARD 17) > set_target_properties(mytarget PRIVATE POSITION_INDEPENDENT CODE_1) > set(CMAKE_VERBOSE_MAKEFILE TRUE) > ... > ... > set(CXX_FLAGS ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}) .. or whatever, depending on the current configuration.. > get_target_property(compile_options, mytarget, COMPILE_OPTIONS) > add_custom_command(OUTPUT myheader.h.gch > COMMAND ${CMAKE_CXX_COMPILER} ${CXX_FLAGS} ${compile_options} -fPIC -std=gnu++17 -c myheader.h -o myheader.h.gch > DEPENDS myheader.h) > add_custom_target(BuildMyPCH > DEPENDS myheader.h.gch) > add_dependencies(mytarget, BuildMyPCH) > > You'll note that in my custom command I've had to specify -fPIC and -std-gnu++17 explicitly, because they aren't included among either CXX_FLAGS or COMPILE_OPTIONS. I've looked for them among the COMPILE_DEFINITIONS, COMPILE_FEATURES and COMPILE_FLAGS properties of my target as well, but there's no sign of them. And yet if I look at the verbose output when gcc builds other files using the CMake-generated makefile, I see that they are being included automatically. > > So, my question: where is CMake storing these settings, and how can I apply them in my custom command without having to do so manually? As far as I am aware, there is no way of querying the entirety of the command line arguments applied by CMake - you will need to recreate CMake's behavior manually. In case of -fPIC, this could look like this (not tested, so there may be syntax errors, but the principle should work): ... get_target_property(_tmp mytarget POSITION_INDEPENDENT_CODE) if(_tmp AND CMAKE_CXX_COMPILE_OPTIONS_PIC) ? string(APPEND CXX_FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIC}") endif() ... If you have multiple targets that may have different compile options you will probably want to put this in a function that takes a target as input and returns the compiler flags as output. To figure out the names of the variables CMake uses to hold flags to pass to the compiler, search the <...>/share/cmake-3.xx/Modules/Compiler directory. -- *Dr. Eric D?nges* Senior Software Engineer MVTec Software GmbH | Arnulfstr. 205 | 80634 Munich | Germany doenges at mvtec.com | Tel: +49 89 457 695-0 | www.mvtec.com Find our privacy policy here . Sign up for our MVTec Newsletter! Gesch?ftsf?hrer: Dr. Wolfgang Eckstein, Dr. Olaf Munkelt Amtsgericht M?nchen HRB 114695 MVTec Software GmbH Logo -------------- next part -------------- An HTML attachment was scrubbed... URL: From doenges at mvtec.com Mon Nov 4 02:43:37 2019 From: doenges at mvtec.com (Eric Doenges) Date: Mon, 4 Nov 2019 08:43:37 +0100 Subject: [CMake] Stray backslash appearing when CMAKE_CXX_FLAGS_RELEASE used in custom command In-Reply-To: References: Message-ID: <297778a4-99e8-151e-6b08-3819c3667ba0@mvtec.com> Am 01.11.19 um 17:24 schrieb Stephen Morris: > On 1 November at 10:02, Stephen Morris wrote: > >> My approach is basically to set up a custom command thus: >> set(CXX_FLAGS ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}) .. or whatever, depending on the current configuration.. >> get_target_property(compile_options, mytarget, COMPILE_OPTIONS) add_custom_command(OUTPUT myheader.h.gch >> COMMAND ${CMAKE_CXX_COMPILER} ${CXX_FLAGS} ${compile_options} -fPIC -std=gnu++17 -c myheader.h -o myheader.h.gch >> DEPENDS myheader.h) add_custom_target(BuildMyPCH >> DEPENDS myheader.h.gch) add_dependencies(mytarget, BuildMyPCH) > My earlier question still stands, but at the time I wrote it I had only tested it for Debug builds where ${CMAKE_CXX_FLAGS_DEBUG} consisted of a single item, '-g'. > > I've since tried doing the same thing for a Release build, and this failed because ${CMAKE_CXX_FLAGS_RELEASE} has two items, '-O3 -DNDEBUG'. When the custom command is executed, this somehow becomes "-O3\ -DNDEBUG" on the command line, and the presence of the stray backslash causes the compilation to fail with the message, > > "cc1plus: error: argument to '-O' should be a non-negative integer. 'g', 's' or 'fast'" > > So why isn't the cmake variable placed properly onto the command line, and what can I do to prevent this behaviour? Welcome to the wonderful world of lists and their interaction with quoting in CMake ! Since space is used as a list item separator outside of double quoted strings, CMake is escaping the space within CXX_FLAGS to keep it as a single element within the list of arguments passed to add_custom_command. To avoid this, you need to turn CXX_FLAGS into a list prior to using it in add_custom_command: string(REGEX REPLACE " " ";" CXX_FLAGS "${CXX_FLAGS}") Of course, this will not work if you want to pass a double quoted string as an actual command line argument ... -- *Dr. Eric D?nges* Senior Software Engineer MVTec Software GmbH | Arnulfstr. 205 | 80634 Munich | Germany doenges at mvtec.com | Tel: +49 89 457 695-0 | www.mvtec.com Find our privacy policy here . Sign up for our MVTec Newsletter! Gesch?ftsf?hrer: Dr. Wolfgang Eckstein, Dr. Olaf Munkelt Amtsgericht M?nchen HRB 114695 MVTec Software GmbH Logo -------------- next part -------------- An HTML attachment was scrubbed... URL: From philip at codeminded.be Mon Nov 4 06:32:37 2019 From: philip at codeminded.be (Philip Van Hoof) Date: Mon, 04 Nov 2019 12:32:37 +0100 Subject: [CMake] Providing multiple different MAJOR API versions with write_basic_package_version_file Message-ID: <4294aea45b9723333bfdcdd3cc5258cb0c119db4.camel@codeminded.be> Hello, After Craig's very interesting presentation at CppCon 2019* I learned a bunch of new things which I of course immediately wanted to try out**. I read about the write_basic_package_version_file which is in CMakePackageConfigHelpers. Craig also mentioned in the presentation that you can have a so called API-version in the target's name. And that for example Qt does this (Qt5Core, which has the MAJOR number 5 in its target name). For my target name I prefer to have the API version after a dash, like how GLib and DBus packages do it: libglib-2.0.so.0.6200.1 on current Ubuntu, for example in /usr/lib/x86_64-linux-gnu. I wonder what that means for the property of write_basic_package_version_file. In the autotools and meson world, the usage of pkg-config files seems to indicate that the same filename naming scheme applies to the .pc file: /usr/lib/x86_64-linux-gnu/pkgconfig/glib-2.0.pc This allows me to distinguish between older MAJOR API versions of GLib and newer MAJOR API versions of it, using FindPkgConfig*** Supposedly something similar is possible with find_package's .cmake files as installed by write_basic_package_version_file? How do I provide a PackageNameConfigVersion.cmake for major version 1.0 and 2.0 (the equivalent of PackageName-1.0.pc and PackageName-2.0.pc in the pkgconfig directory)? Kind regards, Philip * https://www.youtube.com/watch?v=m0DwB4OvDXk ** https://github.com/pvanhoof/dir-examples/commit/523cab5edaff99acba037218d5b95227cb2487a9 *** https://cmake.org/cmake/help/v3.15/module/FindPkgConfig.html -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: From s-morris at n-eos.com Mon Nov 4 18:07:08 2019 From: s-morris at n-eos.com (Stephen Morris) Date: Mon, 4 Nov 2019 23:07:08 +0000 Subject: [CMake] Stray backslash appearing when CMAKE_CXX_FLAGS_RELEASE used in custom command In-Reply-To: References: Message-ID: On 4 November at 08:43, Eric Doenges wrote: > Welcome to the wonderful world of lists and their interaction with quoting in CMake ! Since space is used > as a list item separator outside of double quoted strings, CMake is escaping the space within CXX_FLAGS > to keep it as a single element within the list of arguments passed to add_custom_command. To avoid this, > you need to turn CXX_FLAGS into a list prior to using it in add_custom_command: > >string(REGEX REPLACE " " ";" CXX_FLAGS "${CXX_FLAGS}") > >Of course, this will not work if you want to pass a double quoted string as an actual command line argument ... Thank you! I'd never have worked this out for myself, though it makes perfect sense now you've explained it. Thank you for answering my other question about -fPIC -std=gnu++17 as well. From roman.wueger at gmx.at Tue Nov 5 08:56:20 2019 From: roman.wueger at gmx.at (=?utf-8?Q?Roman_W=C3=BCger?=) Date: Tue, 5 Nov 2019 14:56:20 +0100 Subject: [CMake] [cmake-developers] productbuild: Installing to absolute system path or to user home path In-Reply-To: References: Message-ID: <90332C82-1C1F-457D-871D-865DC9497725@gmx.at> Hello, The main wish is to install to the user directory as described in the documentation, the absolute path to the ?all users? works already: Here is the description from the manual, also attached as an image Automatic plug-in loading Lightroom automatically checks for plug-ins in the standard Modules folder where other Lightroom settings are stored: In Mac OS (current user) In Mac OS (all users) In Windows XP plug-in and also installs a helper application. Plug-ins that are installed in this location are automatically listed in the Plug-in Manager dialog. You can use the dialog to enable or disable such a plug-in, but not to remove it. The Remove button is dimmed when such a plug-in is selected. ~/Library/Application Support/Adobe/Lightroom/Modules /Library/Application Support/Adobe/Lightroom/Modules C:\Documents and Users\username\Application Data\Adobe\Lightroom\Modules C:\Users\username\AppData\Roaming\Adobe\Lightroom\Modules You may want to use this location if, for example, you are writing an installer that installs a Lightroom In Windows 7/Vista Regards Roman > Am 01.11.2019 um 05:10 schrieb David Aguilar : > > ? > I would also suggest avoiding absolute paths so that the user can tell you where to root the installation. > > One way to do that is to use GNUInstallDirs so that the user can specify the install prefix. And maybe you want to let them user their home directory be default if they've not specified it: > > > include(GNUInstallDirs) > > if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) > # NOTE: default to the home directory, assumes $HOME is defined in the environment > set(CMAKE_INSTALL_PREFIX $ENV{HOME} CACHE PATH "Installation prefix" FORCE) > endif () > > [... usual stuff here ...] > > # NOTE: relative path > install(TARGETS target_name DESTINATION "Library/Application Support/Adobe/Lightroom/Modules") > > > Then the user would just "make && make install" and it'll install to their ~/Library directory by default. > > Then, if they have the permissions to do so, they can install to the global system location using: > > cmake -D CMAKE_INSTALL_PREFIX=/ . && > make && > sudo make install > > Mixing both in the same cmake invocation can be done, but now you've made it impossible to install into other locations (for testing, packaging, etc). > > For example, someone might want to package it without sudo, so they might want to do this instead of "sudo make install": > > make DESTDIR=$PWD/tmp install > > and then you have a tmp/Library/ directory structure that can be made into a macOS .pkg installer: > > pkgbuild --install-location / --identifier org.domain.pkgs.example --version 1.0.0 --root tmp example-1.0.0.pkg > > And now you have a .pkg installer that updates the global /Library directory without needing to be root to build it. > > > Question -- is this a situation where you want a single build to install into both locations, or is the literally the same plugin and it only needs to be in one of the two locations (global vs. user)? I interpreted your question to be about the latter, where the user really only needs one or the other, and it's the same plugin in both cases. > > I don't know if cpack handles this for you, but hopefully this is helpful advice. > > >> On Thu, Oct 31, 2019 at 10:19 AM David Cole via cmake-developers wrote: >> According to the docs, the INSTALL command uses the absolute path if >> it is given as the DESTINATION, so .... it should work. >> https://cmake.org/cmake/help/latest/command/install.html >> >> Did you try using a double quoted string, instead of escaping the >> space with a backslash? >> >> I think this should work for the absolute one: >> INSTALL( ... DESTINATION "/abs/path/to/some folder") >> >> For the one in the home directory, I'm not sure if a string that >> starts with "~" is considered absolute or not, so it may or may not >> end up where you expect it. Can you resolve it before hand with a >> get_filename_component call, (or otherwise), and pass in a string that >> begins with "/" ...? >> >> >> Hope this helps, >> David C. >> >> >> On Mon, Oct 28, 2019 at 4:36 PM Roman W?ger wrote: >> > Hello, >> > I tried to install a file/directory with productbuild on macOS which is generated with CPack >> > The most of the files are installed correctly, but I have two problems: >> > >> > If I want to install to ?/Library/Application\ Support/Adobe/Lightroom/Modules? >> > If I want to install to the users modules folder ?~/Library/Application\ Support/Adobe/Lightroom/Modules? >> > >> > How can I archive these two? >> > >> > I already tried the following with no luck: >> > install(DIRECTORY $/${CMAKE_PROJECT_NAME}.lrplugin >> > DESTINATION /Library/Application\ Support/Adobe/Lightroom/Modules) >> > >> > install(DIRECTORY $/${CMAKE_PROJECT_NAME}.lrplugin >> > DESTINATION ~/Library/Application\ Support/Adobe/Lightroom/Modules) >> > Best Regards >> > >> > Roman > -- > David -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image0.jpeg Type: image/jpeg Size: 228007 bytes Desc: not available URL: From stefan at seefeld.name Tue Nov 5 09:44:36 2019 From: stefan at seefeld.name (stefan) Date: Tue, 5 Nov 2019 09:44:36 -0500 Subject: [CMake] combining multiple build variants into the same package (and install prefix) Message-ID: Hello, I'm trying to repackage an upstream project that's using CMake. The project is set up to allow me to specify whether to build shared or static libs using the BUILD_SHARED_LIBS when invoking cmake. However, rather than generating two separate packages for the two variants, I'd like to combine both into a single package. The built artefacts themselves allow that, as the only difference is that one variant produces *.so files and the other *.a. Everything else (notably headers) should be identical. This means I can join both into the same install prefix. The difficulty arises with the generated cmake helper files that define the targets for downstream projects, as both build variant would generate the same target names, but one referring to the shared libs, the other to the static libs. Is there a way to rename one set of exported target names to allow both to co-exist without having to install the build variants into distinct install prefixes ? Thanks, Stefan -- ...ich hab' noch einen Koffer in Berlin... -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.png Type: image/png Size: 1478 bytes Desc: not available URL: From robert.maynard at kitware.com Tue Nov 5 12:13:46 2019 From: robert.maynard at kitware.com (Robert Maynard) Date: Tue, 5 Nov 2019 12:13:46 -0500 Subject: [CMake] [ANNOUNCE] CMake Discourse forum now available Message-ID: A Discourse forum is now available for the CMake community: https://discourse.cmake.org Discourse offers users more control over their level of participation, allowing them to subscribe or unsubscribe by category or individual topic. Users may choose to participate by web forum, email, or both. To get started, see our Forum Help page: https://discourse.cmake.org/faq User accounts may be created using Email Registration, a GitHub Account, or a Google Account. For those who prefer email over web forums, the Forum Help page includes instructions to participate in the forum purely via email. Creating topics in the forum via email (and receiving replies) is supported *with or without* registering a user account. User accounts may be configured to receive email notifications for forum activity at several levels of granularity, or to receive email notifications for all activity like a mailing list. To facilitate a transition period, the current mailman-based mailing lists will remain active until at least the end of March 2020, and their archives will remain available after that. See you on discourse.cmake.org! From stefan at seefeld.name Tue Nov 5 21:06:26 2019 From: stefan at seefeld.name (Stefan Seefeld) Date: Tue, 5 Nov 2019 21:06:26 -0500 Subject: [CMake] cross-testing support in cmake Message-ID: <83448af5-8226-fa1f-c6e5-09e12186218e@seefeld.name> Hello, I'm looking for ways to enable cross-testing with cmake. I imagine some helper script that, during test execution, copies the test binary to a test platform, runs the binary there, and reports back the test result. Does cmake have support for such a scenario ? Thanks, Stefan -- ...ich hab' noch einen Koffer in Berlin... -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: .signature.png Type: image/png Size: 2754 bytes Desc: not available URL: From MillerHenry at JohnDeere.com Wed Nov 6 07:52:54 2019 From: MillerHenry at JohnDeere.com (Miller Henry) Date: Wed, 6 Nov 2019 12:52:54 +0000 Subject: [CMake] cross-testing support in cmake In-Reply-To: <83448af5-8226-fa1f-c6e5-09e12186218e@seefeld.name> References: <83448af5-8226-fa1f-c6e5-09e12186218e@seefeld.name> Message-ID: Easy enough. ADD_TEST can run whatever you want. I created a simple cmake function Function(RUN_REMOTE_TEST testname, other_args) # insert useful code here? add_test(${testname} remote_run_test ${binary_dir}/${testname} other test runner script args? ) End_function() You will have to figure out how to make the above work for your needs, but the idea is simple enough. One useful thing I do in our function is create a custom target to run the test as part of the build as well, that way the TDD cycle runs all the tests. From: CMake On Behalf Of Stefan Seefeld Sent: Tuesday, November 5, 2019 8:06 PM To: CMake Subject: [CMake] cross-testing support in cmake Hello, I'm looking for ways to enable cross-testing with cmake. I imagine some helper script that, during test execution, copies the test binary to a test platform, runs the binary there, and reports back the test result. Does cmake have support for such a scenario ? Thanks, [Stefan] -- ...ich hab' noch einen Koffer in Berlin... -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.png Type: image/png Size: 2754 bytes Desc: image001.png URL: From afuller at teradici.com Wed Nov 6 11:00:18 2019 From: afuller at teradici.com (Andrew Fuller) Date: Wed, 6 Nov 2019 16:00:18 +0000 Subject: [CMake] cross-testing support in cmake In-Reply-To: <83448af5-8226-fa1f-c6e5-09e12186218e@seefeld.name> References: <83448af5-8226-fa1f-c6e5-09e12186218e@seefeld.name> Message-ID: Does https://cmake.org/cmake/help/latest/prop_tgt/CROSSCOMPILING_EMULATOR.html#prop_tgt:CROSSCOMPILING_EMULATOR do what you're looking for? ________________________________ From: CMake on behalf of Stefan Seefeld Sent: November 5, 2019 6:06 PM To: CMake Subject: [CMake] cross-testing support in cmake Hello, I'm looking for ways to enable cross-testing with cmake. I imagine some helper script that, during test execution, copies the test binary to a test platform, runs the binary there, and reports back the test result. Does cmake have support for such a scenario ? Thanks, [Stefan] -- ...ich hab' noch einen Koffer in Berlin... -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: .signature.png Type: image/png Size: 2754 bytes Desc: .signature.png URL: From stefan at seefeld.name Wed Nov 6 11:11:43 2019 From: stefan at seefeld.name (stefan) Date: Wed, 6 Nov 2019 11:11:43 -0500 Subject: [CMake] cross-testing support in cmake In-Reply-To: References: <83448af5-8226-fa1f-c6e5-09e12186218e@seefeld.name> Message-ID: On 2019-11-06 11:00 a.m., Andrew Fuller wrote: > Does > https://cmake.org/cmake/help/latest/prop_tgt/CROSSCOMPILING_EMULATOR.html#prop_tgt:CROSSCOMPILING_EMULATOR?do > what you're looking for? Yes, that's *exactly* what I was looking for; thanks ! (I'm actually using `gtest_add_tests()`, but assuming that this internally calls `add_test()`, I assume the injection will still happen. Many thanks ! Stefan -- ...ich hab' noch einen Koffer in Berlin... -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.png Type: image/png Size: 1478 bytes Desc: not available URL: From david.aldrich.ntml at gmail.com Thu Nov 7 06:27:46 2019 From: david.aldrich.ntml at gmail.com (David Aldrich) Date: Thu, 7 Nov 2019 11:27:46 +0000 Subject: [CMake] Using generator expression with add_library Message-ID: I want to build a shared library for Linux and a static library for Windows. So I have tried: set (_star_lib_name "StdStars") add_library(${_star_lib_name} $<$:SHARED> $<$:STATIC> "" ) but that gives me error: CMake Error at C:/SVNProj/zodiac/branches/TRY_TML_CMake_3Oct2019/StarLibs/StdStars/CMakeLists.txt:7 (add_library): Cannot find source file: STATIC Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx What is the correct way of doing this please? -------------- next part -------------- An HTML attachment was scrubbed... URL: From petr.kmoch at gmail.com Thu Nov 7 06:44:54 2019 From: petr.kmoch at gmail.com (Petr Kmoch) Date: Thu, 7 Nov 2019 12:44:54 +0100 Subject: [CMake] Using generator expression with add_library In-Reply-To: References: Message-ID: Hi. The argument STATIC or SHARED is processed at CMake configure time (that is, when CMake is executing the add_library() command). However, generator expressions are only evaluated at generate time, which comes only after all CMake code is processed. Fortunately for you, compiler ID is something that is already known at configure time, meaning you don't need to use a genex to read it. You can just do this: if(MSVC) set(LibType STATIC) else() set(LibType SHARED) endif() add_library( ${_star_lib_name} ${LibType} ... ) (Feel free to modify the if(), use CMAKE__COMPILER_ID ( https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html) etc. as necessary). Petr On Thu, 7 Nov 2019 at 12:28, David Aldrich wrote: > I want to build a shared library for Linux and a static library for > Windows. So I have tried: > > set (_star_lib_name "StdStars") > > add_library(${_star_lib_name} > $<$:SHARED> > $<$:STATIC> > "" > ) > > but that gives me error: > > CMake Error at C:/SVNProj/zodiac/branches/TRY_TML_CMake_3Oct2019/StarLibs/StdStars/CMakeLists.txt:7 (add_library): > Cannot find source file: > > STATIC > > Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm > .hpp .hxx .in .txx > > What is the correct way of doing this please? > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > https://cmake.org/mailman/listinfo/cmake > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.aldrich.ntml at gmail.com Thu Nov 7 06:52:49 2019 From: david.aldrich.ntml at gmail.com (David Aldrich) Date: Thu, 7 Nov 2019 11:52:49 +0000 Subject: [CMake] Using generator expression with add_library In-Reply-To: References: Message-ID: Thank you. So I guess I can make it as simple as: if(MSVC) add_library(${_star_lib_name} STATIC "") else() add_library(${_star_lib_name} SHARED "") endif() I just wondered if there was a more elegant way. On Thu, Nov 7, 2019 at 11:45 AM Petr Kmoch wrote: > Hi. > > The argument STATIC or SHARED is processed at CMake configure time (that > is, when CMake is executing the add_library() command). However, generator > expressions are only evaluated at generate time, which comes only after all > CMake code is processed. > > Fortunately for you, compiler ID is something that is already known at > configure time, meaning you don't need to use a genex to read it. You can > just do this: > > if(MSVC) > set(LibType STATIC) > else() > set(LibType SHARED) > endif() > add_library( > ${_star_lib_name} > ${LibType} > ... > ) > > (Feel free to modify the if(), use CMAKE__COMPILER_ID ( > https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html) > etc. as necessary). > > Petr > > On Thu, 7 Nov 2019 at 12:28, David Aldrich > wrote: > >> I want to build a shared library for Linux and a static library for >> Windows. So I have tried: >> >> set (_star_lib_name "StdStars") >> >> add_library(${_star_lib_name} >> $<$:SHARED> >> $<$:STATIC> >> "" >> ) >> >> but that gives me error: >> >> CMake Error at C:/SVNProj/zodiac/branches/TRY_TML_CMake_3Oct2019/StarLibs/StdStars/CMakeLists.txt:7 (add_library): >> Cannot find source file: >> >> STATIC >> >> Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm >> .hpp .hxx .in .txx >> >> What is the correct way of doing this please? >> -- >> >> Powered by www.kitware.com >> >> Please keep messages on-topic and check the CMake FAQ at: >> http://www.cmake.org/Wiki/CMake_FAQ >> >> Kitware offers various services to support the CMake community. For more >> information on each offering, please visit: >> >> CMake Support: http://cmake.org/cmake/help/support.html >> CMake Consulting: http://cmake.org/cmake/help/consulting.html >> CMake Training Courses: http://cmake.org/cmake/help/training.html >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Follow this link to subscribe/unsubscribe: >> https://cmake.org/mailman/listinfo/cmake >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From afuller at teradici.com Thu Nov 7 10:50:46 2019 From: afuller at teradici.com (Andrew Fuller) Date: Thu, 7 Nov 2019 15:50:46 +0000 Subject: [CMake] Using generator expression with add_library In-Reply-To: References: , Message-ID: Another option is to use BUILD_SHARED_LIBS to control static vs. shared. Set it to false on MSVC and true everywhere else, then omit the library type in the add_library calls that you wish to have controllable behaviour. Those add_library calls will then consult BUILD_SHARED_LIBS to determine whether to generate a static or shared lib. ________________________________ From: CMake on behalf of David Aldrich Sent: November 7, 2019 3:52 AM To: Petr Kmoch Cc: CMake MailingList Subject: Re: [CMake] Using generator expression with add_library Thank you. So I guess I can make it as simple as: if(MSVC) add_library(${_star_lib_name} STATIC "") else() add_library(${_star_lib_name} SHARED "") endif() I just wondered if there was a more elegant way. On Thu, Nov 7, 2019 at 11:45 AM Petr Kmoch > wrote: Hi. The argument STATIC or SHARED is processed at CMake configure time (that is, when CMake is executing the add_library() command). However, generator expressions are only evaluated at generate time, which comes only after all CMake code is processed. Fortunately for you, compiler ID is something that is already known at configure time, meaning you don't need to use a genex to read it. You can just do this: if(MSVC) set(LibType STATIC) else() set(LibType SHARED) endif() add_library( ${_star_lib_name} ${LibType} ... ) (Feel free to modify the if(), use CMAKE__COMPILER_ID (https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html) etc. as necessary). Petr On Thu, 7 Nov 2019 at 12:28, David Aldrich > wrote: I want to build a shared library for Linux and a static library for Windows. So I have tried: set (_star_lib_name "StdStars") add_library(${_star_lib_name} $<$:SHARED> $<$:STATIC> "" ) but that gives me error: CMake Error at C:/SVNProj/zodiac/branches/TRY_TML_CMake_3Oct2019/StarLibs/StdStars/CMakeLists.txt:7 (add_library): Cannot find source file: STATIC Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx What is the correct way of doing this please? -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake -------------- next part -------------- An HTML attachment was scrubbed... URL: From sramnath at axon.com Thu Nov 7 12:01:41 2019 From: sramnath at axon.com (samyuktar) Date: Thu, 7 Nov 2019 10:01:41 -0700 (MST) Subject: [CMake] Using CMake with TI armcl and armar Message-ID: <1573146101480-0.post@n2.nabble.com> Hi, I want to include some open-source stacks in my code for the CC1352P1, so I'm trying to use cmake with armcl compiler and armar archiver. Here is my code: cmake_minimum_required(VERSION 3.10) set (CMAKE_CONFIGURATION_TYPES "Debug;Release") project(lwIP) # Example lwIP application set(LWIP_DIR "/Users/sramnath/lwip_blinky/lwip") set (LWIP_DEFINITIONS LWIP_DEBUG=1) set(CMAKE_VERBOSE_MAKEFILE ON) #include(CMakeForceCompiler) # this one is important set(CMAKE_SYSTEM_NAME Generic) set (cc1352p1_board_SRCS ${LWIP_DIR}/CC1352P1_LAUNCHXL_TIRTOS.cmd ${LWIP_DIR}/CC1352P1_LAUNCHXL_fxns.c ${LWIP_DIR}/CC1352P1_LAUNCHXL.c ${LWIP_DIR}/ccfg.c ) set (LWIP_INCLUDE_DIRS "${LWIP_DIR}/src/include" "${LWIP_DIR}" "${LWIP_DIR}/contrib/" "${LWIP_DIR}/contrib/ports/tirtos/include" "${LWIP_DIR}/contrib/examples/test" # "/Users/sramnath/lwip_out/lwip/contrib/ports/tirtos" "${LWIP_DIR}/contrib/ports/tirtos" "${LWIP_TIRTOS_SRCS}" ) set (LWIP_BIOS_OPTS "--define=ti_sysbios_BIOS_swiEnabled__D=TRUE" "--define=ti_sysbios_BIOS_taskEnabled__D=TRUE" "--define=ti_sysbios_BIOS_clockEnabled__D=TRUE" "--define=ti_sysbios_BIOS_runtimeCreatesEnabled__D=TRUE" "--define=ti_sysbios_hal_Hwi_DISABLE_ALL_HOOKS" "--define=ti_sysbios_knl_Swi_DISABLE_ALL_HOOKS" "--define=ti_sysbios_BIOS_smpEnabled__D=FALSE" "--define=ti_sysbios_Build_useHwiMacros" "--define=ti_sysbios_knl_Swi_numPriorities__D=6" "--define=ti_sysbios_knl_Task_deleteTerminatedTasks__D=FALSE" "--define=ti_sysbios_knl_Task_numPriorities__D=16" "--define=ti_sysbios_knl_Task_checkStackFlag__D=FALSE" "--define=ti_sysbios_knl_Task_initStackFlag__D=TRUE" "--define=ti_sysbios_knl_Task_DISABLE_ALL_HOOKS" "--define=ti_sysbios_knl_Clock_TICK_SOURCE=ti_sysbios_knl_Clock_TickSource_TIMER" "--define=ti_sysbios_knl_Clock_TICK_MODE=ti_sysbios_knl_Clock_TickMode_DYNAMIC" "--define=ti_sysbios_hal_Core_delegate_getId=ti_sysbios_hal_CoreNull_getId__E" "--define=ti_sysbios_hal_Core_delegate_interruptCore=ti_sysbios_hal_CoreNull_interruptCore__E" "--define=ti_sysbios_hal_Core_delegate_lock=ti_sysbios_hal_CoreNull_lock__E" "--define=ti_sysbios_hal_Core_delegate_unlock=ti_sysbios_hal_CoreNull_unlock__E" "--define=ti_sysbios_hal_Core_numCores__D=1" "--define=ti_sysbios_hal_CoreNull_numCores__D=1" "--define=ti_sysbios_utils_Load_taskEnabled__D=TRUE" "--define=ti_sysbios_utils_Load_swiEnabled__D=FALSE" "--define=ti_sysbios_utils_Load_hwiEnabled__D=FALSE" "--define=ti_sysbios_family_arm_m3_Hwi_dispatcherSwiSupport__D=TRUE" "--define=ti_sysbios_family_arm_m3_Hwi_dispatcherTaskSupport__D=TRUE" "--define=ti_sysbios_family_arm_m3_Hwi_dispatcherAutoNestingSupport__D=TRUE" "--define=ti_sysbios_knl_Semaphore_supportsEvents__D=FALSE" "--define=ti_sysbios_knl_Semaphore_supportsPriority__D=FALSE" "--define=xdc_runtime_Assert_DISABLE_ALL" "--define=xdc_runtime_Log_DISABLE_ALL" ) set(CCS_PATH "/Applications/ti_ccs9/ccs9/ccs") # set(CMAKE_MAKE_PROGRAM ${CCS_PATH}/utils/bin/gmake CACHE PATH "make program" FORCE) set(CG_TOOL_ROOT ${CCS_PATH}/tools/compiler/ti-cgt-arm_18.12.2.LTS) # specify the cross compiler SET(CMAKE_C_COMPILER_FLAGS "") # SET(CMAKE_C_COMPILER "${CG_TOOL_ROOT}/bin/armcl ${cc1352p1_board_SRCS}" CACHE PATH "c compiler") SET(CMAKE_C_COMPILER "/Applications/ti_ccs9/ccs9/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/bin/armcl") SET(CMAKE_CXX_COMPILER ${CMAKE_C_COMPILER} CACHE PATH "cxx compiler") #SET(CMAKE_ASM_COMPILER ${CG_TOOL_ROOT}/bin/armasm CACHE PATH "assembler") SET(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER} CACHE PATH "assembler") SET(CMAKE_LINKER ${CMAKE_C_COMPILER} CACHE PATH "linker") # Add the default include and lib directories for tool chain include_directories(${CG_TOOL_ROOT}/include) link_directories(${CG_TOOL_ROOT}/lib) message("link_directories(${CG_TOOL_ROOT}/lib)") # set target environment set(CMAKE_FIND_ROOT_PATH ${CG_TOOL_ROOT}) # specifiy target cpu flags set(PLATFORM_CONFIG_C_FLAGS "-mv7M4 --code_state=32 --float_support=VFPv3D16 --abi=eabi -me -g --diag_warning=225 --display_error_number --diag_wrap=off --enum_type=packed --include_path=${CG_TOOL_ROOT}/include --define=_RM46x_ --define=_VFP_SUPPORT_=1" CACHE STRING "platform config c flags") set(PLATFORM_CONFIG_L_FLAGS "-i ${CG_TOOL_ROOT}/lib --reread_libs --warn_sections --rom_model") # combine flags to C and C++ flags SET(CMAKE_C_FLAGS "${PLATFORM_CONFIG_C_FLAGS} ${CMAKE_C_FLAGS}" CACHE STRING "platform config c flags") SET(CMAKE_CXX_FLAGS "${PLATFORM_CONFIG_C_FLAGS} ${CMAKE_CXX_FLAGS}" CACHE STRING "platform config cxx flags") SET(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS}") SET(LIB "-l rtsv7R4_T_le_v3D16_eabi.lib") SET(CMD_SRCS "/Users/sramnath/lwip_blinky/lwip/CC1352P1_LAUNCHXL_TIRTOS.cmd") set(TARGET_NAME "cc1352p1_launchxl") # SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_CONFIG_L_FLAGS}" CACHE STRING "platform config linker exe files") set(LIB "liblwipboard.a") set(CMAKE_C_OUTPUT_EXTENSION ".obj") # cross-compiler # CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER}) #executable type set(CMAKE_EXECUTABLE_SUFFIX ".obj") SET(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} --c_file=../main.c -z --map_file=${TARGET_NAME}.map --output_file=${TARGET_NAME} ${PLATFORM_CONFIG_L_FLAGS} ${CMD_SRCS} ${LIB} --include_path ${LWIP_INCLUDE_DIR} --verbose " CACHE STRING "linker executable") MESSAGE( STATUS "Compile flags for C: " ${CMAKE_C_FLAGS} ) MESSAGE( STATUS "Compile flags for asm: " ${CMAKE_ASM_FLAGS} ) MESSAGE( STATUS "linker flags for asm: " ${CMAKE_EXE_LINKER_FLAGS} ) MESSAGE( STATUS "linker executable is " ${CMAKE_C_LINK_EXECUTABLE} ) MESSAGE( STATUS "here is the compiler you are using " ${CMAKE_C_COMPILER}) add_executable(test ${cc1352p1_board_SRCS} "../main.c" ) The trouble is, "add_executable" by default adds a -o -c command, which is different from wha the armcl compiler is expecting (it expects a format that is given in the CMAKE_C_LINK_EXECUTABLE variable). As a result, it does not actually compile any of the source files to produce .o files and I am unable to build the project. How do I actually execute the command specified in the CMAKE_C_LINK_EXECUTABLE variable? When I remove the "add_executable" command, I get the following message : /usr/local/Cellar/cmake/3.15.5/bin/cmake -S/Users/sramnath/lwip_blinky/lwip - B/Users/sramnath/lwip_blinky/lwip/build --check-build-system CMakeFiles/Makefile.cmake 0 /usr/local/Cellar/cmake/3.15.5/bin/cmake -E cmake_progress_start /Users/sramnath/lwip_blinky/lwip/build/CMakeFiles /Users/sramnath/lwip_blinky/lwip/build/CMakeFiles/progress.marks /Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/Makefile2 all make[1]: Nothing to be done for `all'. /usr/local/Cellar/cmake/3.15.5/bin/cmake -E cmake_progress_start /Users/sramnath/lwip_blinky/lwip/build/CMakeFiles 0 and when I do add it, I get /usr/local/Cellar/cmake/3.15.5/bin/cmake -S/Users/sramnath/lwip_blinky/lwip -B/Users/sramnath/lwip_blinky/lwip/build --check-build-system CMakeFiles/Makefile.cmake 0 /usr/local/Cellar/cmake/3.15.5/bin/cmake -E cmake_progress_start /Users/sramnath/lwip_blinky/lwip/build/CMakeFiles /Users/sramnath/lwip_blinky/lwip/build/CMakeFiles/progress.marks /Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/Makefile2 all /Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/test.dir/build.make CMakeFiles/test.dir/depend cd /Users/sramnath/lwip_blinky/lwip/build && /usr/local/Cellar/cmake/3.15.5/bin/cmake -E cmake_depends "Unix Makefiles" /Users/sramnath/lwip_blinky/lwip /Users/sramnath/lwip_blinky/lwip /Users/sramnath/lwip_blinky/lwip/build /Users/sramnath/lwip_blinky/lwip/build /Users/sramnath/lwip_blinky/lwip/build/CMakeFiles/test.dir/DependInfo.cmake --color= Scanning dependencies of target test /Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/test.dir/build.make CMakeFiles/test.dir/build [ 50%] Building C object CMakeFiles/test.dir/main.c.o /Applications/ti_ccs9/ccs9/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/bin/armcl -I/Applications/ti_ccs9/ccs9/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -o CMakeFiles/test.dir/main.c.o -c /Users/sramnath/lwip_blinky/lwip/main.c >> WARNING: object file specified, but linking not enabled It seems to make the .o file, but when I try to link the files, I get the following message: [ 60%] Linking C static library liblwipboard.a /usr/local/Cellar/cmake/3.15.5/bin/cmake -P CMakeFiles/lwipboard.dir/cmake_clean_target.cmake /usr/local/Cellar/cmake/3.15.5/bin/cmake -E cmake_link_script CMakeFiles/lwipboard.dir/link.txt --verbose=1 /Applications/ti_ccs9/ccs9/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/bin/armar -av liblwipboard.a CMakeFiles/lwipboard.dir/CC1352P1_LAUNCHXL_fxns.c.o CMakeFiles/lwipboard.dir/CC1352P1_LAUNCHXL.c.o CMakeFiles/lwipboard.dir/ccfg.c.o ==> new archive 'liblwipboard.a' ==> building archive 'liblwipboard.a' --> error: 'CMakeFiles/lwipboard.dir/CC1352P1_LAUNCHXL_fxns.c.o' not found --> error: 'CMakeFiles/lwipboard.dir/CC1352P1_LAUNCHXL.c.o' not found --> error: 'CMakeFiles/lwipboard.dir/ccfg.c.o' not found make[2]: *** [liblwipboard.a] Error 1 make[2]: *** Deleting file `liblwipboard.a' make[1]: *** [CMakeFiles/lwipboard.dir/all] Error 2 make: *** [all] Error 2 Please let me know how I can proceed. -- Sent from: http://cmake.3232098.n2.nabble.com/ From wangzhen11aaa at 163.com Fri Nov 8 00:33:36 2019 From: wangzhen11aaa at 163.com (=?GBK?B?zfXV8Q==?=) Date: Fri, 8 Nov 2019 13:33:36 +0800 (GMT+08:00) Subject: [CMake] (No Subject) Message-ID: <5a7a1c45.7f43.16e4980ed35.Coremail.wangzhen11aaa@163.com> Hello Sent from Mail Master -------------- next part -------------- An HTML attachment was scrubbed... URL: From doenges at mvtec.com Fri Nov 8 02:22:23 2019 From: doenges at mvtec.com (Eric Doenges) Date: Fri, 8 Nov 2019 08:22:23 +0100 Subject: [CMake] Using CMake with TI armcl and armar In-Reply-To: <1573146101480-0.post@n2.nabble.com> References: <1573146101480-0.post@n2.nabble.com> Message-ID: <0d48bb80-cf94-d6a8-eede-473758eb1ab3@mvtec.com> Am 07.11.19 um 18:01 schrieb samyuktar: > SET(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} > --c_file=../main.c -z --map_file=${TARGET_NAME}.map > --output_file=${TARGET_NAME} ${PLATFORM_CONFIG_L_FLAGS} ${CMD_SRCS} ${LIB} > --include_path ${LWIP_INCLUDE_DIR} --verbose " CACHE STRING > "linker executable") As far as I can tell, you are trying to combine the compile and link steps, but CMake expects these to be separate steps. Furthermore, cmake knows about the TI compiler (see <...>/share/cmake-3.xx/Modules/Compiler/TI-C.cmake and friends), so you shouldn't need to mess around with CMAKE_C_LINK_EXECUTABLE - let cmake handle that for you. The flags you need for linking that cmake doesn't already add for you by default should go into CMAKE_EXE_LINKER_FLAGS__INIT (see the cmake documenation for details), or be set using the add_link_options and/or target_link_options commands (again, see the cmake documentation for details). > [ 50%] Building C object CMakeFiles/test.dir/main.c.o > /Applications/ti_ccs9/ccs9/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/bin/armcl > -I/Applications/ti_ccs9/ccs9/ccs/tools/compiler/ti-cgt-arm_18.12.2.LTS/include > -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -o > CMakeFiles/test.dir/main.c.o -c /Users/sramnath/lwip_blinky/lwip/main.c >>> WARNING: object file specified, but linking not enabled That compiler invocation looks wrong - I'm pretty sure the TI compiler doesn't use the MacOS10.14.sdk sysroot. I think what's happening here is that you set your toolchain settings (CMAKE_C_COMPILER and friends) after the project() command - but the project() command tells cmake to check what compiler you are using to figure out how it must be called, and it is using your host system's compiler (probably Apple's clang) to do so. You should put the toolchain definitions into a toolchain file as described in the cmake-toolchains(7) documentation and tell cmake to use it my specifying -DCMAKE_TOOLCHAIN_FILE= on the cmake command line. I once played around a bit with cgtools 5.2.9 for Arm using the following toolchain file: --- SNIP --- # TI cgt-arm_5.2.9 cmake toolchain script # # This file is based on the cmake-toolchains(7) documentation. # Set the operating system and processor architecture set(CMAKE_SYSTEM_NAME Generic) set(CMAKE_SYSTEM_PROCESSOR arm) set(CMAKE_SYSTEM_VERSION 1) # Setup CMake's rules for using the CMAKE_FIND_ROOT_PATH for cross-compilation set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) # TI cgtools command line programs set(SDK_PATH "/proj/he/opt/ti/ti-cgt-arm_5.2.9") set(SDK_BIN "${SDK_PATH}/bin") # This compiler doesn't work with CMAKE_SYSROOT, but we do need to set our # CMAKE_FIND_ROOT_PATH. Note that setting a variable will override the value in # the cache if the CACHE option was not used, so if we want to be able to use a # CMAKE_FIND_ROOT_PATH passed to cmake via the command line, we must make sure # not to overwrite any value that was already set. if(NOT CMAKE_FIND_ROOT_PATH) ? set(CMAKE_FIND_ROOT_PATH ${SDK_PATH}) endif() set(CMAKE_C_COMPILER "${SDK_BIN}/armcl") set(CMAKE_CXX_COMPILER "${SDK_BIN}/armcl") set(CMAKE_ASM_COMPILER "${SDK_BIN}/armasm") set(CMAKE_AR "${SDK_BIN}/armar") set(CMAKE_LINKER "${SDK_BIN}/armlnk") string(CONCAT ARCH_C_FLAGS ? "-mv=7A8 --abi=eabi -me --float_support=VFPv3 --neon --printf_support=full") set(CMAKE_C_FLAGS_INIT "${ARCH_C_FLAGS}") set(CMAKE_CXX_FLAGS_INIT "${ARCH_C_FLAGS}") # Normally, cmake checks if the compiler can compile and link programs. For # TI's cgtools the link step doesn't work, and there seems to be no easy way # to fix this. Instead, we simply disable the compiler checks for C and C++. set(CMAKE_C_COMPILER_WORKS 1) set(CMAKE_CXX_COMPILER_WORKS 1) --- SNIP --- Note that the project this was intended for thankfully never got anywhere so I didn't pursue this much further than being able to compile libz with it ("thankfully" because the TI compiler is pretty awful). -- *Dr. Eric D?nges* Senior Software Engineer MVTec Software GmbH | Arnulfstr. 205 | 80634 Munich | Germany doenges at mvtec.com | Tel: +49 89 457 695-0 | www.mvtec.com Find our privacy policy here . Sign up for our MVTec Newsletter! Gesch?ftsf?hrer: Dr. Wolfgang Eckstein, Dr. Olaf Munkelt Amtsgericht M?nchen HRB 114695 MVTec Software GmbH Logo -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.aldrich.ntml at gmail.com Fri Nov 8 07:02:16 2019 From: david.aldrich.ntml at gmail.com (David Aldrich) Date: Fri, 8 Nov 2019 12:02:16 +0000 Subject: [CMake] Windows C++ static library fails to access external method during initialization Message-ID: Hi, I have a linker problem with a Windows C++ project that uses a static library. I have described the problem on StackOverflow here: https://stackoverflow.com/questions/58765494/windows-c-static-library-fails-to-access-external-method-during-initialization I think the problem could be resolved by adjusting the CMakeLists.txt file. Please could someone have a look at the above link and comment either in StackOverflow or reply here? I am using Ninja with the VS2019 C++ compiler on Windows 10. Thanks in advance, David -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.aldrich.ntml at gmail.com Fri Nov 8 09:08:00 2019 From: david.aldrich.ntml at gmail.com (David Aldrich) Date: Fri, 8 Nov 2019 14:08:00 +0000 Subject: [CMake] Windows C++ static library fails to access external method during initialization In-Reply-To: References: Message-ID: Fixed using OBJECT libraries. Thank you to anyone here who answered on StackOverflow. On Fri, Nov 8, 2019 at 12:02 PM David Aldrich wrote: > Hi, I have a linker problem with a Windows C++ project that uses a static > library. I have described the problem on StackOverflow here: > > > https://stackoverflow.com/questions/58765494/windows-c-static-library-fails-to-access-external-method-during-initialization > > > I think the problem could be resolved by adjusting the CMakeLists.txt > file. Please could someone have a look at the above link and comment > either in StackOverflow or reply here? > > I am using Ninja with the VS2019 C++ compiler on Windows 10. > > Thanks in advance, > David > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rubendibattista at gmail.com Fri Nov 8 11:18:38 2019 From: rubendibattista at gmail.com (Ruben Di Battista) Date: Fri, 8 Nov 2019 17:18:38 +0100 Subject: [CMake] Suddendly missing members when compiling on macOS Mojave Message-ID: Hello,? Tryign to compile a project that built correctly since now. I guess something changed on my system, and now I?m getting this error:? Scanning dependencies of target Mercurve /Applications/Xcode.app/Contents/Developer/usr/bin/make -f src/libs/CMakeFiles/Mercurve.dir/build.make src/libs/CMakeFiles/Mercurve.dir/build [ ?4%] Building CXX object src/libs/CMakeFiles/Mercurve.dir/BlockMerger.cxx.o cd /Users/rubendibattista/git/x/Mercurve/build/src/libs && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ ?-DMercurve_EXPORTS -I/Users/rubendibattista/git/x/Mercurve/src/libs -isystem /opt/local/include/vtk-8.1 -isystem /opt/local/include -isystem /opt/local/include/mpich-mp -isystem /opt/local/include/libxml2 ?-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.14 -fPIC ? -std=gnu++11 -o CMakeFiles/Mercurve.dir/BlockMerger.cxx.o -c /Users/rubendibattista/git/x/Mercurve/src/libs/BlockMerger.cxx In file included from /Users/rubendibattista/git/x/Mercurve/src/libs/BlockMerger.cxx:21: In file included from /Users/rubendibattista/git/x/Mercurve/src/libs/BlockMerger.h:28: In file included from /Users/rubendibattista/git/x/Mercurve/src/libs/types.h:25: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/unordered_set:363: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__hash_table:19: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:314:9: error: no member named 'signbit' in the global namespace using ::signbit; ? ? ? ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:315:9: error: no member named 'fpclassify' in the global namespace using ::fpclassify; ? ? ? ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:316:9: error: no member named 'isfinite' in the global namespace Something got messed up with Xcode update I guess. I also tried to downgrade Xcode without success. Does anyone have hints on how to solve this? In particular I?m not entirely sure that the `-isysroot` flag the cmake provides is correct anymore. Is that possible?? _ -. .? |???? ', ; |?????? ?? |????????? RdB ,., |?????? .' '. |???? -' `? https://rdb.is -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: Message signed with OpenPGP using AMPGpg URL: From juan.e.sanchez at gmail.com Fri Nov 8 11:35:31 2019 From: juan.e.sanchez at gmail.com (Juan Sanchez) Date: Fri, 8 Nov 2019 10:35:31 -0600 Subject: [CMake] Suddendly missing members when compiling on macOS Mojave In-Reply-To: References: Message-ID: I had an issue last week, where the isysroot setting was messed up, after I had done an xcode update. Even though I am using Mojave (10.14), instead of Catalina (10.15), xcode has apparently upped the version number from 10.14 to 10.15. /Applications/Xcode.app/Contents/Developer/Platforms/ MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk Creating a brand new build directory fixed the problem, since the cached information concerning the compiler environment was invalid. Regards, Juan On Fri, Nov 8, 2019 at 10:18 AM Ruben Di Battista wrote: > Hello, > > Tryign to compile a project that built correctly since now. I guess > something changed on my system, and now I?m getting this error: > > Scanning dependencies of target Mercurve > /Applications/Xcode.app/Contents/Developer/usr/bin/make -f > src/libs/CMakeFiles/Mercurve.dir/build.make > src/libs/CMakeFiles/Mercurve.dir/build > [ 4%] Building CXX object > src/libs/CMakeFiles/Mercurve.dir/BlockMerger.cxx.o > cd /Users/rubendibattista/git/x/Mercurve/build/src/libs && > /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ > -DMercurve_EXPORTS -I/Users/rubendibattista/git/x/Mercurve/src/libs > -isystem /opt/local/include/vtk-8.1 -isystem /opt/local/include -isystem > /opt/local/include/mpich-mp -isystem /opt/local/include/libxml2 -isysroot > /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk > -mmacosx-version-min=10.14 -fPIC -std=gnu++11 -o > CMakeFiles/Mercurve.dir/BlockMerger.cxx.o -c > /Users/rubendibattista/git/x/Mercurve/src/libs/BlockMerger.cxx > In file included from > /Users/rubendibattista/git/x/Mercurve/src/libs/BlockMerger.cxx:21: > In file included from > /Users/rubendibattista/git/x/Mercurve/src/libs/BlockMerger.h:28: > In file included from > /Users/rubendibattista/git/x/Mercurve/src/libs/types.h:25: > In file included from > /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/unordered_set:363: > In file included from > /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__hash_table:19: > /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:314:9: > error: no member named 'signbit' in the global namespace > using ::signbit; > ~~^ > /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:315:9: > error: no member named 'fpclassify' in the global namespace > using ::fpclassify; > ~~^ > /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:316:9: > error: no member named 'isfinite' in the global namespace > > Something got messed up with Xcode update I guess. I also tried to > downgrade Xcode without success. Does anyone have hints on how to solve > this? In particular I?m not entirely sure that the `-isysroot` flag the > cmake provides is correct anymore. Is that possible? > > _ > -. .? |???? > ', ; |?????? > ?? |????????? RdB > ,., |?????? > .' '. |???? > -' `? > https://rdb.is > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > https://cmake.org/mailman/listinfo/cmake > -------------- next part -------------- An HTML attachment was scrubbed... URL: From osmanzakir90 at hotmail.com Fri Nov 8 14:22:04 2019 From: osmanzakir90 at hotmail.com (Osman Zakir) Date: Fri, 8 Nov 2019 19:22:04 +0000 Subject: [CMake] CMake Error Flagged in MSVC Toolchain File Message-ID: I tried to configure a FLTK build with this: "make .. -G "Visual Studio 16 2019" -A x64 -T "ClangCl" -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_CXX_COMPILER=C:/llvm-project/install/bin/clang-cl.exe -DCMAKE_C_COMPILER=C:/llvm-project/install/bin/clang-cl.exe -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Xclang -pedantic -Xclang -std=c++17 -Xclang -Wall -Xclang -fexceptions" " and got an error saying: " CMake Error at C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Microsoft/VC/v160/Platforms/x64/PlatformToolsets/ClangCL/Toolset.targets:1: Parse error. Expected a command name, got unquoted argument with text? "