-
Notifications
You must be signed in to change notification settings - Fork 629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to link different IlmBase library names according to Debug/Release configuration, when building OpenEXR with CMake + VS2015? #301
Comments
Hi Zhou, if you try the develop branch, there is work in progress to generate debug libraries for windows with a different name than release, and for the debug and release OpenEXR libraries to appropriately link the IlmBase libraries. There is a bit more work to do to clean it up, In particular, there should probably be ALIAS libraries to simplify linking, but perhaps you can start with what is on the develop branch already. |
So, generally speaking, we need to add this feature by manually writing scripts in CMakeLists.txt? I had thought there is some existing option/flag provided by CMake that can do the work automatically on command line. Thank you for your reply and the excellent work on the development of OpenEXT&IlmBase. |
You can do it from the command line. After you have gone through the configuration steps, to build Release from the command line -
Debug -
(set cpucount to a realistic number) |
Sorry I just noticed the reply made 6 days ago. I didn't quite understand the reply however, perhaps because we are not on the same page. I read some more CMake documentations these days and confirmed my hypothesis that CMake does provide a mechanism for linking different filenames based on Debug/Release configuration. This is written in the doc of target_link_libraries function. As I mentioned in the original post, we can use |
I thought the following is true, please correct me if I am wrong. I have read the documentation page, and it seems that this is true:
|
Current top of tree on develop differentiates static libraries with _s, debug with _d, static debug with _s_d. Import libraries have also been introduced (IlmBase::Half, IlmBase::Iex, etc). These libraries have debug and release variants with them. So I think the things you need are now all in place. |
As commented above, we believe there are all the controls necessary for setting suffixes on the generated libraries. In addition, the cmake system has been overhauled to use the "modern" cmake which should be a bit more robust. Create a new issue if there are any new issues. thank you for the report! |
My environment:
I want to use different output names of
IlmBase
libraries for better management according to Debug/Release configuration in VS. Specifically, if built under Debug mode, the output name will be suffixed with "_d", say, Half-2_2_d.lib, Iex-2_2_d.dll. Otherwise, the names are left unchanged. For IlmBase, this is done by the following CMake command line:cmake -DCMAKE_DEBUG_POSTFIX=_d -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=C:\...\openexr-develop\IlmBase\install_ -G"Visual Studio 14 2015 Win64" ..
Then I proceed to building
OpenEXR
and problem arises here. What I want is to set the IlmBase library names to be linked to OpenEXR project on the CMake command line only, instead of modifying existingCMakeLists.txt
scripts, or changing names manually inside VS afterwards. I searched google for hours but the answers are all using target_link_libraries or add_library with IMPORTED flag, which requires modification of CMakeLists.txt. So my question is, does CMake have a general mechanism to set the suffix of linked library names, like the CMAKE_INSTALL_PREFIX I used above? Is there any flags I can use on CMake command line to specify the suffix of linked libraries for OpenEXR based on Debug/Release configuration, or, aiming at the final goal, how to link different IlmBase library names according to Debug/Release configuration? As a side note, the CMake command line I used to build OpenEXR is as follows:cmake -DBUILD_SHARED_LIBS=ON -DILMBASE_PACKAGE_PREFIX=C:\...\openexr-develop\IlmBase\install_ -DCMAKE_INSTALL_PREFIX=C:\...\openexr-develop\OpenEXR\install_ -DZLIB_LIBRARY=C:\...\zlib-1.2.11\install\lib\zlib.lib -DZLIB_INCLUDE_DIR=C:\...\zlib-1.2.11\install\include -G"Visual Studio 14 2015 Win64" ..
I tried something like IMPORTED_LOCATION_DEBUG but of no avail.
Thank you for help.
The text was updated successfully, but these errors were encountered: