[CMake] include_external_msproject, add_dependencies and build type (debug/release)
Holzinger, Axel (ALC NetworX GmbH)
Axel.Holzinger at alcnetworx.de
Tue Oct 27 12:15:35 EDT 2015
Hi David,
thank you. I'll take a look at it. But it's not a problem finding/linking to the external libs. The problem is the dependencies. If I add the dependencies to every linked binary (in contrast to a lib) it works. What doesn't work is having a lib being dependent on an external lib and having the binary being dependendent from the lib and automatically adding dependendies from the other (external) lib.
Regards
Axel
On Tue, Oct 27, 2015 at 5:08 PM, David Cole wrote:
> CMAKE_BUILD_TYPE is not typically used/useful with the Visual
> Studio generators. You may want to look into using the
> CMAKE_CFG_INTDIR variable instead.
>
> https://cmake.org/cmake/help/v3.3/variable/CMAKE_CFG_INTDIR.html
>
>
>
> On Tue, Oct 27, 2015 at 8:06 AM, Holzinger, Axel (ALC NetworX
> GmbH) <Axel.Holzinger at alcnetworx.de> wrote:
> > Hi list,
> >
> > I'm on my wits end with include_external_msproject,
> add_dependencies and build type.
> >
> > This is the situation: I have a CMake project with an external
> static library A which is included in the build via
> include_external_msproject, a static library B and a binary C.
> >
> > B is depemding on A
> > C is depending on B
> >
> > My upper (above the directories for B and C) CMakeLists.txt
> looks like this:
> >
> > include_external_msproject(A ${CMAKE_SOURCE_DIR}/A.vcxproj)
> >
> > The CMakeLists.txt for B has these (and other) parts:
> >
> > cmake_policy(GET CMP0046 cmp)
> > if (NOT cmp STREQUAL "OLD")
> > cmake_policy(SET CMP0046 OLD)
> > endif ()
> > add_dependencies (B A)
> > cmake_policy(SET CMP0046 NEW)
> > target_link_libraries(B
> > ${CMAKE_BINARY_DIR}/Win32/${CMAKE_BUILD_TYPE}/A.lib)
> >
> > The CMakeLists.txt for C has these (and other) parts:
> >
> > target_link_libraries(C B)
> >
> > In reality there are othe libs too. I reduced complexity to
> make it easier to understand the scenario.
> >
> > The stuff above works fine for CMAKE_BUILD_TYPE=Debug, meaning
> in Visual Studio 2013 in the project build dependencies for B I
> see that it's depending on A and so the build order is A first
> then B. The project build dependencies for C say that the binary
> is depending on B and A and the build oreder is A first, then B
> and then C.
> >
> > Perfect.
> >
> > But with CMAKE_BUILD_TYPE=Release I see that B is depending on
> A, but C is ONLY depending on B, but NOT on A.
> >
> > Can anybody explain what's going on? Any hint would be greatly
> appreciated.
> >
> > Thank you
> > Axel
> >
> > PS: I know that setting policies to OLD isn't the nice way, but
> I don't know of any other solution the depend on a external
> Visual Studio project.
> >
> > --
> >
> > 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
More information about the CMake
mailing list