Re: [CMake] CMAKE changing Visual Studio Settings
Thanks for all the help on this topic. The user file generation worked like a charm. Really helped out a lot. Thanks to Nils as well for the great advice. This makes my MSVC projects much more manageable. Thanks! On Tue, Jul 22, 2014 at 2:12 PM, Eric Clark ecl...@ara.com wrote: -Original Message- From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of John Drescher Sent: Monday, July 21, 2014 3:55 PM To: Joseph Rosensweig Cc: CMake ML Subject: Re: [CMake] CMAKE changing Visual Studio Settings So CMAKE can't control the options int he *.user files I guess :-\? Would a potential workaround be to find a command line tool that can edit these and run it as a post-build script? CMake gives you the functionality needed to edit these via your own script. I mean reading and writing files replacing text. In our CMake system, we wanted to be able to set the program to execute when Start Debugging was clicked in Visual Studio. This option is stored in the *.user file and thus you cannot change it via CMake directly. However, you CAN build a template of the *.user file and put some CMake variables inside of it. Then, when you build the project files with CMake, you can use the configure_file command to create the user's *.user file from the template and the values you have for each variable in the template. This option works beautifully and it is very easy to setup. Hope this helps... Eric John -- 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 -- 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] CMAKE changing Visual Studio Settings
No problem at all Joseph! I am glad to hear that you got it working! Thanks - Eric From: anoneiron...@gmail.com [mailto:anoneiron...@gmail.com] On Behalf Of Joseph Rosensweig Sent: Wednesday, July 30, 2014 2:42 PM To: Eric Clark Cc: John Drescher; CMake ML Subject: Re: [CMake] CMAKE changing Visual Studio Settings Thanks for all the help on this topic. The user file generation worked like a charm. Really helped out a lot. Thanks to Nils as well for the great advice. This makes my MSVC projects much more manageable. Thanks! On Tue, Jul 22, 2014 at 2:12 PM, Eric Clark ecl...@ara.com wrote: -Original Message- From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of John Drescher Sent: Monday, July 21, 2014 3:55 PM To: Joseph Rosensweig Cc: CMake ML Subject: Re: [CMake] CMAKE changing Visual Studio Settings So CMAKE can't control the options int he *.user files I guess :-\? Would a potential workaround be to find a command line tool that can edit these and run it as a post-build script? CMake gives you the functionality needed to edit these via your own script. I mean reading and writing files replacing text. In our CMake system, we wanted to be able to set the program to execute when Start Debugging was clicked in Visual Studio. This option is stored in the *.user file and thus you cannot change it via CMake directly. However, you CAN build a template of the *.user file and put some CMake variables inside of it. Then, when you build the project files with CMake, you can use the configure_file command to create the user's *.user file from the template and the values you have for each variable in the template. This option works beautifully and it is very easy to setup. Hope this helps... Eric John -- 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 -- 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] CMAKE changing Visual Studio Settings
Hi Joseph, On Mon, Jul 21, 2014 at 4:51 PM, Joseph Rosensweig jrose...@gmail.com wrote: ... in my CMAKE I have places where I do things like if(CMAKE_BUILD_TYPE STREQUAL Debug) then do this else do that. This is the sort of logic best achieved through generator expressions. How to do it specifically really depends. Generator expressions are used all over CMake in various different contexts so how to apply them depends on what exactly you are trying to achieve. i.e. my CXX Flags will change based on the CMAKE_BUILD_TYPE ... What am I missing? This is actually much simpler than the general case. CMake has specific compiler flags for all builds, release, debug, release with debug info, and minimum size release. They can be set / ammended with: # Flags that get applied to all builds set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} /My /EXTRA /COMPILER /FLAGS) # Flags that only apply to debug builds set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} /ADDITIONAL /DEBUG /ONLY /FLAGS) # Flags that only apply to release builds set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE} /ADDITIONAL /RELEASE /ONLY /FLAGS) The resulting compiler flags that get used are a combination of the general CMAKE_CXX_FLAGS and CMAKE_CXX_FLAGS for the current selected build configuration. Back to the first issue though, what other types of build-type specific logic are you trying to achieve? There may be a better / easier 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] CMAKE changing Visual Studio Settings
-Original Message- From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of John Drescher Sent: Monday, July 21, 2014 3:55 PM To: Joseph Rosensweig Cc: CMake ML Subject: Re: [CMake] CMAKE changing Visual Studio Settings So CMAKE can't control the options int he *.user files I guess :-\? Would a potential workaround be to find a command line tool that can edit these and run it as a post-build script? CMake gives you the functionality needed to edit these via your own script. I mean reading and writing files replacing text. In our CMake system, we wanted to be able to set the program to execute when Start Debugging was clicked in Visual Studio. This option is stored in the *.user file and thus you cannot change it via CMake directly. However, you CAN build a template of the *.user file and put some CMake variables inside of it. Then, when you build the project files with CMake, you can use the configure_file command to create the user's *.user file from the template and the values you have for each variable in the template. This option works beautifully and it is very easy to setup. Hope this helps... Eric John -- 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 -- 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] CMAKE changing Visual Studio Settings
I've been using CMAKE recently on Linux and Windows and I really like it. Its a great way of spinning up a project and organizing your builds. There are just a few things that are bugging me and I'm hoping to get help here. Visual Studio Settings Every time CMAKE generates a project it will be a fresh solution and will not maintain any of the settings you applied to the Visual Studio project. I know that many things such as CMAKE_CXX_FLAGS, etc can change the properties. But what if I want to change settings such as Suppress Startup Banner, Environment, Enabling Microsoft Symbol Server, Enabling Native Code Debugging. How do I force CMAKE to set the options I want for fields like these? Combining Debug/Release/Etc into one solution It seems that with CMAKE you have to do separate generations for Debug/Release/etc. But in typical manually created Visual Studio projects you can combine the profiles and just change a project setting to get your new settings. Is it possible to generate a single solution file from CMAKE? Thanks! -- 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] CMAKE changing Visual Studio Settings
On 07/21/2014 08:05 AM, Joseph Rosensweig wrote: Visual Studio Settings Every time CMAKE generates a project it will be a fresh solution and will not maintain any of the settings you applied to the Visual Studio project. I know that many things such as CMAKE_CXX_FLAGS, etc can change the properties. But what if I want to change settings such as Suppress Startup Banner, Environment, Enabling Microsoft Symbol Server, Enabling Native Code Debugging. How do I force CMAKE to set the options I want for fields like these? Some options are stored in the project files and can be derived from compiler options (e.g. Suppress Startup Banner is derived from /NOLOGO). These would get overwritten on generation. Other options (like e.g. the Debugging Environment) are stored in .user files which are neither generated nor overwritten by CMake. Combining Debug/Release/Etc into one solution It seems that with CMAKE you have to do separate generations for Debug/Release/etc. CMake has multi-configuration and single-configuration generators. The Visual Studio generators are multi-configuration which means they generate a single solution which contains all configurations (per default Debug, Release, RelWithDebInfo and MinSizeRel). Nils -- 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] CMAKE changing Visual Studio Settings
On Sun, Jul 20, 2014 at 11:49 PM, Nils Gladitz nilsglad...@gmail.com wrote: On 07/21/2014 08:05 AM, Joseph Rosensweig wrote: Visual Studio Settings Every time CMAKE generates a project it will be a fresh solution and will not maintain any of the settings you applied to the Visual Studio project. I know that many things such as CMAKE_CXX_FLAGS, etc can change the properties. But what if I want to change settings such as Suppress Startup Banner, Environment, Enabling Microsoft Symbol Server, Enabling Native Code Debugging. How do I force CMAKE to set the options I want for fields like these? Some options are stored in the project files and can be derived from compiler options (e.g. Suppress Startup Banner is derived from /NOLOGO). These would get overwritten on generation. So CMAKE can't control the options int he *.user files I guess :-\? Would a potential workaround be to find a command line tool that can edit these and run it as a post-build script? Other options (like e.g. the Debugging Environment) are stored in .user files which are neither generated nor overwritten by CMake. Combining Debug/Release/Etc into one solution It seems that with CMAKE you have to do separate generations for Debug/Release/etc. CMake has multi-configuration and single-configuration generators. The Visual Studio generators are multi-configuration which means they generate a single solution which contains all configurations (per default Debug, Release, RelWithDebInfo and MinSizeRel). I see that it makes these profiles in my Visual Studio project. But in my CMAKE I have places where I do things like if(CMAKE_BUILD_TYPE STREQUAL Debug) then do this else do that. i.e. my CXX Flags will change based on the CMAKE_BUILD_TYPE. However I don't see these getting reflected in my Visual Studio configurations. What am I missing? Nils -- 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] CMAKE changing Visual Studio Settings
So CMAKE can't control the options int he *.user files I guess :-\? Would a potential workaround be to find a command line tool that can edit these and run it as a post-build script? CMake gives you the functionality needed to edit these via your own script. I mean reading and writing files replacing text. John -- 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