I'm trying to use differents configurations for multi-library use.
I explain : i have to use many library for one solution, but i need to change the configuration for each library target, for a debug use of my solution some library will be in 'debug' mode but some other needs a 'Render' configuration. (It's 3rdParty project i can't edit them)
I want to know if its possible.
Thanks !
Here an example the result i wanted to have :
http://i48.tinypic.com/mtugqf.png
You can almost do this. CMake allows for extra configurations by setting CMAKE_CONFIGURATION_TYPES, so in your case this would be
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES};Render" CACHE STRING "" FORCE)
This needs to be after the project command.
However, this adds a new configuration type to all targets. I don't think CMake has the ability to mix different configurations for individual targets. You'd still have to manually modify the specific libraries' configs via the Configuration Manager once CMake had created the .sln.
Related
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Debug vs. release in .NET
Debug/Release difference
What is the difference between Release and Debug modes in Visual Studio while building a project?
Debug and Release are just labels for different solution configurations. You can add others if you want. A project I once worked on had one called "Debug Internal" which was used to turn on the in-house editing features of the application. You can see this if you go to Configuration Manager... (it's on the Build menu). You can find more information on MSDN Library under Configuration Manager Dialog Box.
Each solution configuration then consists of a bunch of project configurations. Again, these are just labels, this time for a collection of settings for your project. For example, our C++ library projects have project configurations called "Debug", "Debug_Unicode", "Debug_MT", etc.
The available settings depend on what type of project you're building. For a .NET project, it's a fairly small set: #defines and a few other things. For a C++ project, you get a much bigger variety of things to tweak.
In general, though, you'll use "Debug" when you want your project to be built with the optimiser turned off, and when you want full debugging/symbol information included in your build (in the .PDB file, usually). You'll use "Release" when you want the optimiser turned on, and when you don't want full debugging information included.
Well, it depends on what language you are using, but in general they are 2 separate configurations, each with its own settings. By default, Debug includes debug information in the compiled files (allowing easy debugging) while Release usually has optimizations enabled.
As far as conditional compilation goes, they each define different symbols that can be checked in your program, but they are language-specific macros.
The main difference is when compiled in debug mode, pdb files are also created which allow debugging (so you can step through the code when its running). This however means that the code isn't optimized as much.
In my CMake script I'm adding a custom configuration type like suggested in the CMake FAQ:
if(CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CONFIGURATION_TYPES Debug Release MyRelease)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Reset the configurations to what we need" FORCE)
endif()
I would like to have a MyRelease configuration in my generated Visual Studio 2015 project that behaves like Release but with an additional post-build step. The problem is, that it appears to use the Debug configuration as the basis by default. This, in turn, becomes a problem when using imported targets that don't explicitly specify the library location for my own configuration type. For example, when using the imported target opencv_core it will try to link against the opencv_core2413d.lib which is defined specifically for Debug configuration.
Is there a way to let custom configuration types inherit from the Release configuration type?
Note: I'm using CMake version 3.12.
I am building a DLL using visual studio, which involves installing the following libraries :
GLM
GLFW
GLEW
I linked those libraries to visual studio using the following method :
specifying Additional Include Directories in the project property page
specifying Additional Dependencies in the project property page
specifying Additional Library Directories in the project property page
Of course GLM is a header only Library, which means that I am only required to specify the Additional Include Directories for GLM. And my dll built perfectly fine.
But the real problem occurs when using the library in a test project. I linked my test project to my library using the method mentioned above, but when I tried to build the test project, it produces the following results :
Cannot open include file <GLFW/glfw3.h>
And the same goes for glew. It seems that these libraries are not found when the library is being used by another test project. How can I fix this? Any help would be highly appreciated.
Set the Additional Include Directories correctly for all projects. The compiler doesn't magically inherit settings from a project which happens to have it's output linked into another project. So you have to provide it the correct include path for any source file it sees. To spare yourself from having hardcoded paths to include directories you could use a property sheet common for both projects. Or you could tackle the problem in code and make use of the PIMPL idiom (eventually as simple as e.g. forward declaring some GL types and using a unique_ptr to them in public classes) so the headers of your project never expose any of the external include files.
In CMake, is it possible to make target dependencies specific to a particular configuration?
My structure is an executable, which can be built with different backend renderers, one OpenGL and the other D3D. The backend renderers have their own (static) libraries, and only one library should be linked in, based on the configuration (eg. GL_Debug, D3D_Debug, etc). However, it doesn't seem as though the add_dependency command has any options for per-configuration settings.
My current solution is to use generation configurations (Debug, Release, etc), and an option to select the renderer type, and regenerate the solution if I'd like to switch. However, this is clunky if I want to switch between the two frequently. Ideally, I would have a solution with all the renderer configurations, and could just switch between them in Visual Studio.
target_link_libraries command may link in configuration-dependent way. Alternatively, generator-expressions can be used for LINK_LIBRARIES property for executable/library.
I've created, debugged, and revised a project that I've been working on, but now I want to be able to specify what version of the binary I'm on. I'm using Eclispe-CDT with MinGW to make this project on my local system, so there is no versioning software involved. Does anyone know how to specify this for both Windows and Linux platforms?
On Windows, the idea is to produce a COFF file with the relevant information.
That is done by adding a step to the build, using windres (found also here).
See this thread as an example.
you could add windres via the project properties/Builders as an additional builder and add the generated object file in the C/C++ Build/GCC C++ Linker/Miscellaneous/Other Objects.
Then you
- a) could do a clean build if the resource is changed or
- b) could change the build options (if you have patience) to change to do a clean build every time you save the project.
On Unix, this doesn't seem to be supported in a similar fashion.