In my project I am using MAP_IMPORTED_CONFIG_FINAL for an external library for a custom configuration FINAL . Is there some working example of how to set the target_link_directories for an imported target for the custom configuration FINAL using cmake.
So here are the steps :
- The external library is boost-1.67.0 which I am installing using the following commands for Debug and Release respectively:
.\bootstrap.bat
.\b2 install --prefix=C:\Dev\third-party\vs2017\boost-1.67.0\Debug toolset=msvc-14.1 address-model=64 link=static -j8 variant=debug
.\b2 install --prefix=C:\Dev\third-party\vs2017\boost-1.67.0\Release toolset=msvc-14.1 address-model=64 link=static -j8 variant=release
- Here is the example project with following structure
boost-example/
|
+-- main.cpp
|
+-- CMakeLists.txt
|
|
+-- CMake/
| |
| +-- AddConfiguration.cmake
| +-- mpIncludeBoost.cmake
| +-- mpSetupMSVCRuntime.cmake
| +-- SetupConfigurations.cmake
The files are found in this gitlab project: https://gitlab.com/sunayanag/boost-example.
For the sln file generated note that in Visual Studio in the Linker section in Additional Library Directories I get C:/Dev/third-party/boost-1_67_0/install/lib/$(Configuration) which evaluates to C:/Dev/third-party/boost-1_67_0/install/lib/Final but this directory does not exist since Final is not a valid configuration of boost, it should be C:/Dev/third-party/boost-1_67_0/install/lib/Release instead.
I was thinking a way of getting around this would be to use target_link_directories but how do I use this with cmake generator expressions in this case.
Thanks