Re: [CMake] Setting install dir based on Debug or Release
Multi-configurations is a bit complex to handle regarding install directories but it is doable. Here is my solution: 1. Handle various possibilities (multi-configs or mono-config). In case of multi-config, you have to rely on variable CMAKE_CFG_INTDIR which be contains information enabling to instantiate the current configuration at runtime. I also force definition of a default config (Debug) if none is specified (in case of mono config) to avoid bad behaviours. if (DEFINED CMAKE_CONFIGURATION_TYPES) # multi-config handling set (CMAKE_BUILD_CONFIG \${BUILD_TYPE}) set (CMAKE_CFG_BUILD_CONFIG ${CMAKE_CFG_INTDIR}) else() # mono config handling if (CMAKE_BUILD_TYPE) set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel FORCE) else() set (CMAKE_BUILD_TYPE Debug CACHE STRING Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel FORCE) endif() set (CMAKE_BUILD_CONFIG ${CMAKE_BUILD_TYPE}) set (CMAKE_CFG_BUILD_CONFIG ${CMAKE_BUILD_TYPE}) endif() 2. Now you can use variables CMAKE_BUILD_CONFIG or CMAKE_CFG_BUILD_CONFIG to define your install prefix. There is two different variables because depending of the context of use, one or the other must be used. Here is an example: add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_BUILD_CONFIG}/output_file COMMAND ${CMAKE_COMMAND} -DBUILD_TYPE=$CONFIG -P script.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT Generating output_file) OUTPUT parameter does not support generator expressions so pattern $CONFIG cannot be used. You have to rely on CMAKE_CFG_INTDIR in case of multi-config but on CMAKE_BUILD_TYPE for mono-config. So use wrapper CMAKE_CFG_BUILD_CONFIG. install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_CONFIG}/output_file DESTINATION ${CMAKE_BUILD_CONFIG}) In case of install command, CMAKE_CFG_INTDIR must not be used in multi-config… So use wrapper CMAKE_BUILD_CONFIG. This is why I have two different variables! Hope this is helpful. Marc From: CMake on behalf of Scott Aron Bloom Date: Tuesday 19 May 2015 19:42 To: cmake@cmake.orgmailto:cmake@cmake.org Subject: [CMake] Setting install dir based on Debug or Release We use the install system, and love it. However, since our install include copies of 3rd party debug libraries that are named the same as the release counterparts (not our call ;() I would like to just have a the path be install.deb rather than “install” We set the CMAKE_INSTLL_PREFIX variable, but all the configurations get set to the same install… The problem I see, is the code only gets executed once, and at that point the CMAKE_BUILD_TYPE isn’t set yet.. Yes I realize this for windows, so it is a multi-config system.. but I cant believe Im the only one with this issue. This is is what Im trying… IF( ${CMAKE_BUILD_TYPE} STREQUAL RelWithDebInfo) SET(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/Install) message( STATUS CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ) ELSEIF( ${CMAKE_BUILD_TYPE} STREQUAL Debug) SET(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/Install.deb) message( STATUS CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ) ELSE() MESSAGE( STATUS CMAKE_BUILD_TYPE not set yet ${CMAKE_BUILD_TYPE} ) ENDIF() Any help would be most appreciated Thanks Scott -- 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: http://public.kitware.com/mailman/listinfo/cmake
[CMake] File organization and the essence of modules
Hello, I wonder how I should organize cmake files in my project. For the moment, I have organized my project like this: == project/ CMakeLists.txt cmake/ modules/ FindLibrary.cmake MyFunction.cmake src/ CMakeLists.txt == If I keep on organizing files like this, the cmake directory will only contain a subdirectory named modules and dedicated to auxiliary files like custom functions and scripts for the find_package function. Actually, it seems to be the case in the installation directory of cmake itself, where a subdirectory named Modules contains both functions and scripts for the find_package function. Does it make sense to separate functions from scripts for the find_package function? Is each script a module in CMake, whatever it contains? What are the different kinds of scripts/modules: functions, scripts for the find_package function, configuration files, what else? Thank you for your help! Cédric -- 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: http://public.kitware.com/mailman/listinfo/cmake
[Cmake-commits] CMake branch, next, updated. v3.2.2-3017-g6e7f531
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project CMake. The branch, next has been updated via 6e7f5313aae143287e158b1e1d38765b85fcf291 (commit) via 0d937f5043e38fbab232ef2aa88e0b07d56264d7 (commit) from abcab61f7ec66715040b67fb42b04aec43cdff92 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log - http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6e7f5313aae143287e158b1e1d38765b85fcf291 commit 6e7f5313aae143287e158b1e1d38765b85fcf291 Merge: abcab61 0d937f5 Author: Brad King brad.k...@kitware.com AuthorDate: Wed May 20 09:01:30 2015 -0400 Commit: CMake Topic Stage kwro...@kitware.com CommitDate: Wed May 20 09:01:30 2015 -0400 Merge topic 'cmake-gui-osx-install-command-line' into next 0d937f50 fixup! cmake-gui: Add --install option to add command-line tools on OS X http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0d937f5043e38fbab232ef2aa88e0b07d56264d7 commit 0d937f5043e38fbab232ef2aa88e0b07d56264d7 Author: Brad King brad.k...@kitware.com AuthorDate: Wed May 20 08:53:57 2015 -0400 Commit: Brad King brad.k...@kitware.com CommitDate: Wed May 20 08:53:57 2015 -0400 fixup! cmake-gui: Add --install option to add command-line tools on OS X diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 4da33de..2d336ee 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -193,8 +193,10 @@ int main(int argc, char** argv) } #if defined(Q_OS_MAC) -# include unistd.h +# include errno.h +# include string.h # include sys/stat.h +# include unistd.h static bool cmOSXInstall(std::string const dir, std::string const tool) { if (tool.empty()) --- Summary of changes: Source/QtDialog/CMakeSetup.cxx |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) hooks/post-receive -- CMake ___ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits
[Cmake-commits] CMake branch, next, updated. v3.2.2-3015-gabcab61
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project CMake. The branch, next has been updated via abcab61f7ec66715040b67fb42b04aec43cdff92 (commit) via b0ea36730847695c5e9579de92e7dd4272cfc27a (commit) from 86ad0abe63dadf14f565bf600fe0483e7cdb5540 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log - http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=abcab61f7ec66715040b67fb42b04aec43cdff92 commit abcab61f7ec66715040b67fb42b04aec43cdff92 Merge: 86ad0ab b0ea367 Author: Brad King brad.k...@kitware.com AuthorDate: Wed May 20 08:38:53 2015 -0400 Commit: CMake Topic Stage kwro...@kitware.com CommitDate: Wed May 20 08:38:53 2015 -0400 Merge topic 'doc-cache-option-space' into next b0ea3673 Help: Spell '-D' option consistently across documentation (#15575) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b0ea36730847695c5e9579de92e7dd4272cfc27a commit b0ea36730847695c5e9579de92e7dd4272cfc27a Author: Brad King brad.k...@kitware.com AuthorDate: Wed May 20 08:30:36 2015 -0400 Commit: Brad King brad.k...@kitware.com CommitDate: Wed May 20 08:30:36 2015 -0400 Help: Spell '-D' option consistently across documentation (#15575) Always show the option with its argument separate in summary text. State in the main documentation that the option and its argument can be given together too. diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt index e4c5873..4207db4 100644 --- a/Help/manual/OPTIONS_BUILD.txt +++ b/Help/manual/OPTIONS_BUILD.txt @@ -27,6 +27,9 @@ command in the project sets the type to ``PATH`` or ``FILEPATH`` then the ``value`` will be converted to an absolute path. + This option may also be given as a single argument: + ``-Dvar:type=value`` or ``-Dvar=value``. + ``-U globbing_expr`` Remove matching entries from CMake cache. diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index b2f7e9d..4bd5a5e 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -9,7 +9,7 @@ Synopsis .. parsed-literal:: cmake [options] (path-to-source | path-to-existing-build) - cmake [(-Dvar=value)...] -P cmake-script-file + cmake [(-D var=value)...] -P cmake-script-file cmake --build dir [options] [-- build-tool-options...] cmake -E command [options...] cmake --find-package options... diff --git a/Source/cmake.h b/Source/cmake.h index 0d1977e..0a1ee7d 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -403,7 +403,7 @@ private: #define CMAKE_STANDARD_OPTIONS_TABLE \ {-C initial-cache, Pre-load a script to populate the cache.}, \ - {-D var:type=value, Create a cmake cache entry.}, \ + {-D var[:type]=value, Create a cmake cache entry.}, \ {-U globbing_expr, Remove matching entries from CMake cache.}, \ {-G generator-name, Specify a build system generator.},\ {-T toolset-name, Specify toolset name if supported by generator.}, \ --- Summary of changes: Help/manual/OPTIONS_BUILD.txt |3 +++ Help/manual/cmake.1.rst |2 +- Source/cmake.h|2 +- 3 files changed, 5 insertions(+), 2 deletions(-) hooks/post-receive -- CMake ___ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits
Re: [CMake] Setting install dir based on Debug or Release
That makes sense.. Ill play with it and see. It looks like a straight forward solution… Scott From: CHEVRIER, Marc [mailto:marc.chevr...@sap.com] Sent: Wednesday, May 20, 2015 12:00 AM To: Scott Aron Bloom; cmake@cmake.org Subject: Re: [CMake] Setting install dir based on Debug or Release Multi-configurations is a bit complex to handle regarding install directories but it is doable. Here is my solution: 1. Handle various possibilities (multi-configs or mono-config). In case of multi-config, you have to rely on variable CMAKE_CFG_INTDIR which be contains information enabling to instantiate the current configuration at runtime. I also force definition of a default config (Debug) if none is specified (in case of mono config) to avoid bad behaviours. if (DEFINED CMAKE_CONFIGURATION_TYPES) # multi-config handling set (CMAKE_BUILD_CONFIG \${BUILD_TYPE}) set (CMAKE_CFG_BUILD_CONFIG ${CMAKE_CFG_INTDIR}) else() # mono config handling if (CMAKE_BUILD_TYPE) set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel FORCE) else() set (CMAKE_BUILD_TYPE Debug CACHE STRING Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel FORCE) endif() set (CMAKE_BUILD_CONFIG ${CMAKE_BUILD_TYPE}) set (CMAKE_CFG_BUILD_CONFIG ${CMAKE_BUILD_TYPE}) endif() 2. Now you can use variables CMAKE_BUILD_CONFIG or CMAKE_CFG_BUILD_CONFIG to define your install prefix. There is two different variables because depending of the context of use, one or the other must be used. Here is an example: add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_BUILD_CONFIG}/output_file COMMAND ${CMAKE_COMMAND} -DBUILD_TYPE=$CONFIG -P script.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT Generating output_file) OUTPUT parameter does not support generator expressions so pattern $CONFIG cannot be used. You have to rely on CMAKE_CFG_INTDIR in case of multi-config but on CMAKE_BUILD_TYPE for mono-config. So use wrapper CMAKE_CFG_BUILD_CONFIG. install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_CONFIG}/output_file DESTINATION ${CMAKE_BUILD_CONFIG}) In case of install command, CMAKE_CFG_INTDIR must not be used in multi-config… So use wrapper CMAKE_BUILD_CONFIG. This is why I have two different variables! Hope this is helpful. Marc From: CMake on behalf of Scott Aron Bloom Date: Tuesday 19 May 2015 19:42 To: cmake@cmake.orgmailto:cmake@cmake.org Subject: [CMake] Setting install dir based on Debug or Release We use the install system, and love it. However, since our install include copies of 3rd party debug libraries that are named the same as the release counterparts (not our call ;() I would like to just have a the path be install.deb rather than “install” We set the CMAKE_INSTLL_PREFIX variable, but all the configurations get set to the same install… The problem I see, is the code only gets executed once, and at that point the CMAKE_BUILD_TYPE isn’t set yet.. Yes I realize this for windows, so it is a multi-config system.. but I cant believe Im the only one with this issue. This is is what Im trying… IF( ${CMAKE_BUILD_TYPE} STREQUAL RelWithDebInfo) SET(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/Install) message( STATUS CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ) ELSEIF( ${CMAKE_BUILD_TYPE} STREQUAL Debug) SET(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/Install.deb) message( STATUS CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ) ELSE() MESSAGE( STATUS CMAKE_BUILD_TYPE not set yet ${CMAKE_BUILD_TYPE} ) ENDIF() Any help would be most appreciated Thanks Scott -- 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: http://public.kitware.com/mailman/listinfo/cmake
[cmake-developers] [CMake 0015577]: The 'project' command overwrites CMAKE_CONFIGURATION_TYPES.
The following issue has been SUBMITTED. == https://public.kitware.com/Bug/view.php?id=15577 == Reported By:Cedric Guerin Assigned To: == Project:CMake Issue ID: 15577 Category: CMake Reproducibility:always Severity: minor Priority: normal Status: new == Date Submitted: 2015-05-20 11:38 EDT Last Modified: 2015-05-20 11:38 EDT == Summary:The 'project' command overwrites CMAKE_CONFIGURATION_TYPES. Description: If you have cmake files in a hierarchy of directories like in the sample provided, and use additional project commands in subdirectories (in my case in order to generate additional Visual Studio Solutions with only a subset of all the libraries generated), the project command will change the value of CMAKE_CONFIGURATION_TYPES to what appears to be a merge of the initial value outside any project declaration and it's current value, and this value will even be stored in the cache, affecting completely unrelated directory subhierarchies. Steps to Reproduce: Simply run cmake on the provided sample. Additional Information: The output of the provided sample in a fresh build directory is: CMAKE_CONFIGURATION_TYPES at start is : CMAKE_CONFIGURATION_TYPES before global project is : Debug;Release;Default CMAKE_CONFIGURATION_TYPES after global project is : Debug;Release;Extra CMAKE_CONFIGURATION_TYPES before libraries project is : Debug;Release;Extra CMAKE_CONFIGURATION_TYPES after libraries project is : Debug;Release;Default;Extra CMAKE_CONFIGURATION_TYPES for runtimes is : Debug;Release;Default;Extra While the expected output whould be for CMAKE_CONFIGURATION_TYPES to remain at Debug;Release;Extra once set. Note that you can remove the assigment to CMAKE_CONFIGURATION_TYPES outside any project, it's only there to help identify what occurs. Without it, cmake considers that the value outside of any project is the one stored in CMakeCache.txt (or the 4 default configurations if there is no CMakeCache.txt), but the overall behavior is the same. == Issue History Date ModifiedUsername FieldChange == 2015-05-20 11:38 Cedric Guerin New Issue 2015-05-20 11:38 Cedric Guerin File Added: Project.zip == -- 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: http://public.kitware.com/mailman/listinfo/cmake-developers
[cmake-developers] [CMake 0015578]: Target property that sets Startup Project in MSVC
The following issue has been SUBMITTED. == http://www.cmake.org/Bug/view.php?id=15578 == Reported By:Davy Durham Assigned To: == Project:CMake Issue ID: 15578 Category: CMake Reproducibility:N/A Severity: feature Priority: normal Status: new == Date Submitted: 2015-05-20 13:10 EDT Last Modified: 2015-05-20 13:10 EDT == Summary:Target property that sets Startup Project in MSVC Description: A means of setting the (default) startup project for MS Visual Studio projects would be great. This is a rehash of mantis2919. In needing the same functionality, the consensus out there is to use https://github.com/michaKFromParis/slnStartupProject after generating the msvc solution with cmake. It is true that the startup project preference is stored in the .suo file and that cmake doesn't generate that, but that's *after* the solution has been opened for the first time. .suo files are not normally stored in source control because they change so much. MSVC apparently sets the first project defined in the .sln as the startup project when it is first opened (before any .suo file exists). And this is what this slnStartupProject application actually alters about the .sln file its given. Would it be possible to add a command, or target property for making sure some specific target is defined first in the .sln file? This would really be helpful. I can do more research if required. == Issue History Date ModifiedUsername FieldChange == 2015-05-20 13:10 Davy DurhamNew Issue == -- 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: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] Regarding the 'run-include-what-you-use' topic
On 5/20/2015 8:48 AM, Brad King wrote: It also would be great to have more than one static analyzer enabled at a time. Like IWYU and clang-tidy and KWStyle and ... We also have support for asan, tsan: http://www.kitware.com/blog/home/post/762 We can also use scan-build (ccc-analyzer and c++-analyzer). https://open.cdash.org/viewNotes.php?buildid=3821481 I looked quickly at the clang-tidy docs and it looks interesting. I see it is setup to use the compile_commands.json file. Originally we looked at running iwyu using that file. However, it became quickly evident that this would be a pain to do. By using it as pre-compile command we can capture its output as compiler warnings and report them on the dashboard. In addition, it can be run in parallel by the build tool (make or ninja). I will take a look at clang-tidy as it might fit into the iwyu setup we created in a similar way. -Bill -- 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: http://public.kitware.com/mailman/listinfo/cmake-developers
[CMake] add_executable with generated files
I have need to make an executable that depends on a generated file. I've read several tutorials on how to do this, but even after following those instructions, I get this error: CMake Error at CMakeLists.txt:436 (add_executable): Cannot find source file: .chop/maint.adb Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp has anyone done this, and if so, do you have tips on how to proceed? Thanks, Tom -- 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: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] add_executable with generated files
On Wed, May 20, 2015 at 3:27 PM, Tom Kacvinsky tom.kacvin...@vectorcast.com wrote: On Wed, May 20, 2015 at 2:57 PM, Tom Kacvinsky tom.kacvin...@vectorcast.com wrote: I have need to make an executable that depends on a generated file. I've read several tutorials on how to do this, but even after following those instructions, I get this error: CMake Error at CMakeLists.txt:436 (add_executable): Cannot find source file: .chop/maint.adb Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp has anyone done this, and if so, do you have tips on how to proceed? Thanks, Tom My mistake, the tutorials I looked at were for using generated files in add_library. I do have a working add_library with generated files, but I can't seem to get generated files to work with add_executable. So is there a difference between the two? add_library allows for use of generated files, but add_executable does not? OK, figured something out. If the rule to generate the file is at the same level CMakeLists.txt (or higher) than the CMakeLists.txt that contains the add_executable command which uses the gnerated file, then everything is OK. But if the add_executable is at a higher level than the rule that gnerates the file, everything falls apart. This is why my add_library example worked but by add_executable example was not. To confuse the issue even further, I have this setup foo/CMakeLists.txt - contains macro that uses add_executable foo/vcast/CMakeLists.txt - contains rule to generate file foo/vcast/progs/CMakeLists.txt - invokes macro defined at level 1, using the file generated at level 2 Apparently this is enough to thow things off. I though the add_executable would have occurred at level 3 as that is where the macro is expanded, but I am guessing cmake expansion of macros doesn't work that way. -- 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: http://public.kitware.com/mailman/listinfo/cmake
Re: [cmake-developers] Regarding the 'run-include-what-you-use' topic
On Wed, May 20, 2015 at 7:34 PM, Bill Hoffman bill.hoff...@kitware.com wrote: I looked quickly at the clang-tidy docs and it looks interesting. I see it is setup to use the compile_commands.json file. Originally we looked at running iwyu using that file. However, it became quickly evident that this would be a pain to do. I can confirm that it is a pain for clang-tidy too. By using it as pre-compile command we can capture its output as compiler warnings and report them on the dashboard. In addition, it can be run in parallel by the build tool (make or ninja). I will take a look at clang-tidy as it might fit into the iwyu setup we created in a similar way. Thanks, I am pretty sure it does. -- 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: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [CMake] add_executable with generated files
My mistake, the tutorials I looked at were for using generated files in add_library. I do have a working add_library with generated files, but I can't seem to get generated files to work with add_executable. So is there a difference between the two? add_library allows for use of generated files, but add_executable does not? On Wed, May 20, 2015 at 2:57 PM, Tom Kacvinsky tom.kacvin...@vectorcast.com wrote: I have need to make an executable that depends on a generated file. I've read several tutorials on how to do this, but even after following those instructions, I get this error: CMake Error at CMakeLists.txt:436 (add_executable): Cannot find source file: .chop/maint.adb Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp has anyone done this, and if so, do you have tips on how to proceed? Thanks, Tom -- 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: http://public.kitware.com/mailman/listinfo/cmake
[CMake] Passing arguments to functions
Hello, I try to wrote a function DownloadThenInstall which calls the ExternalProject_Add function after havind defined useful variables like prefix, download_dir, etc. I would like to call it like this DownloadThenInstall(Eigen) to download and install the Eigen library (for example). But it doesn't work unless I change the call to DownloadThenInstall(${Eigen}) Below is the core of the function. In the first call of DownloadThenInstall, name and url are empty. In the second call of DownloadThenInstall, name and url have the right values. How could I modify my script in order to make the first call, DownloadThenInstall(Eigen), work? Thank you very much! Cédric function(DownloadThenInstall LIBRARY_NAME) string(TOLOWER ${LIBRARY_NAME} LIBRARY_LOWERNAME) string(TOUPPER ${LIBRARY_NAME} LIBRARY_UPPERNAME) #=== # define useful variables for ExternalProject_Add #=== set(${LIBRARY_UPPERNAME}_PREFIX ${EXTERNAL_DIR}/${LIBRARY_LOWERNAME} ) set(${LIBRARY_UPPERNAME}_DOWNLOAD_DIR ${${LIBRARY_UPPERNAME}_PREFIX}/download) set(${LIBRARY_UPPERNAME}_SOURCE_DIR ${${LIBRARY_UPPERNAME}_PREFIX}/src) set(${LIBRARY_UPPERNAME}_BINARY_DIR ${${LIBRARY_UPPERNAME}_PREFIX}/build) set(${LIBRARY_UPPERNAME}_TMP_DIR ${${LIBRARY_UPPERNAME}_PREFIX}/tmp) set(${LIBRARY_UPPERNAME}_STAMP_DIR ${${LIBRARY_UPPERNAME}_PREFIX}/stamp) set(${LIBRARY_UPPERNAME}_INSTALL_DIR ${${LIBRARY_UPPERNAME}_PREFIX}/install) # # messages for debugging purpose (to be removed) # message(STATUS name: ${LIBRARY_NAME}) message(STATUS url: ${${LIBRARY_NAME}_URL}) #= # call to ExternalProject_Add #= endfunction(DownloadThenInstall) -- 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: http://public.kitware.com/mailman/listinfo/cmake