Re: [CMake] Find correct boost among peers
Scott, Rather than having the versions fight one another in BOOST_ROOT, you might consider modifying the CMAKE_PREFIX_PATH to include the versions of boost you have - find_package will search there first (you might be able with just giving it the parent of the boost version). If you set the version and EXACT in the find_package call, each project should be able to find its version. You may also want to look at Boost_NO_SYSTEM_PATHS to ensure the FindBoost module isn't hunting around in places you don't intend. mj > Date: Mon, 8 Feb 2016 09:46:00 +0100 > From: Petr Kmoch> To: "B. Scott Harper" > Cc: "cmake@cmake.org" > Subject: Re: [CMake] Find correct boost among peers > Message-ID: >@mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > Hi Scott. > > Regarding the delimiters: you'd see them if you included the dereference in > the quotes: "Boost root: ${BOOST_ROOT}". When outside quotes, the > delimiters are effectively swallowed up by message(). > > Regarding the main issue: I could be wrong, but from a quick glance at the > FindBoost.cmake module, it seems to me that it doesn't expect > BOOST_ROOT to contain more than one path. If it doesn't work for you > without these hints, you will maybe need to pass them in a different form. I > cannot suggest one, though; I am not versed enough in the FindBoost > module. > > Petr > > On Mon, Feb 8, 2016 at 2:10 AM, B. Scott Harper wrote: > > > I have several versions of boost downloaded on my machine inside a > > "thirdparty" directory. Different projects rely on various versions. > > > > I am trying to find a later version than the first version in that > > collection. I have gotten the closest by using a file(GLOB ...) as follows: > > > > file(GLOB BOOST_ROOT ${THIRD_PARTY_DIR}/boost_*) > find_package(Boost > > 1.60.0 > > REQUIRED) > > > > ...but if I have any versions of Boost earlier than 1.60.0 in this > > case, it will find only the first directory, recognize that it's too > > early, and bail out without trying any other directories. > > > > When I print out the results of the GLOB action using message(STATUS > > "Boost root: " ${BOOST_ROOT}), I don't see any delimiters in the > > string, and I wonder if this it causing the problem? Is this expected > > beahiour or am I using this incorrectly? > > > > Cheers, > > -- Scott > > -- 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] What is the best way to handle Boost dependencies in a package config file
Thanks for the reply, Michi. Forgive me if I'm missing something - how does this help with your package config file? Doesn't Boost_LIBRARIES contain full paths to the component libraries you listed? My understanding is that in order to have a package config file result in something that can be relocated, I'd need to be able to do something like: find_package(Boost CONFIG COMPONENTS system filesystem regex REQUIRED) target_link_libraries(my_target Boost::system Boost::filesystem Boost::regex) That is, the find package would have to create imported targets for the boost dependencies. As far as I know, FindBoost.cmake does not do this. Please correct me if I'm wrong - that would make me most happy! Thanks again for the help. Matt > -Original Message- > From: Michi Henning [mailto:michi.henn...@canonical.com] > Sent: Wednesday, January 27, 2016 1:55 AM > To: Johnson, Matt (GE Healthcare) > Cc: cmake@cmake.org > Subject: Re: [CMake] What is the best way to handle Boost dependencies in > a package config file > > We use this, which works fine for me on Ubuntu: > > find_package(Boost COMPONENTS system filesystem regex serialization > thread log REQUIRED) > > Cheers, > > Michi. > > > On 27 Jan 2016, at 12:54 , Johnson, Matt (GE Healthcare) > <matthew.johns...@med.ge.com> wrote: > > > > I like package config files. I want to use more of them. However, I have a > dependency on boost. While boost has a Find module, it doesn't have a > package config file. I'm not going to be able to depend on the users of my > package building boost via cmake (also, is that still an active thing?). > > > > It seems like the best I could hope for is to generate the package config > > file, > then hack it up to deal with the boost stuff. Has anyone already solved this > problem or have any tips? I found this Hunter package manager > (https://urldefense.proofpoint.com/v2/url?u=https- > 3A__github.com_ruslo_hunter=CwIFAg=IV_clAzoPDE253xZdHuilRgztyh > _RiV3wUrLrDQYWSI=qts7iZJBjQRtedrrcqcDRKGTou2a2ZKSs95InlFGa34 > =PrIOuKSVt-ib8BwXCLUzXhcXKOaI-nPRE3lR3m- > XYH8=2LvLkrDkWzloxqrrBP6UdCiiL0YnWgmToNjL2_5mZTw= ), but it > seems a bit heavyweight when all I want is boost. Also, I can't have my build > system going out and downloading the packages - they all have to come from > an internal source. > > > > Thanks, > > Matt > > > > > > -- > > > > Powered by www.kitware.com > > > > Please keep messages on-topic and check the CMake FAQ at: > > https://urldefense.proofpoint.com/v2/url?u=http- > 3A__www.cmake.org_Wiki > > _CMake- > 5FFAQ=CwIFAg=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI= > > qts7iZJBjQRtedrrcqcDRKGTou2a2ZKSs95InlFGa34=PrIOuKSVt- > ib8BwXCLUzXhcX > > KOaI-nPRE3lR3m- > XYH8=voIOJHSB3_3nWFPCHnLZrEHATQTMvoAv6TceyDyGQZA= > > > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > > > CMake Support: > > https://urldefense.proofpoint.com/v2/url?u=http- > 3A__cmake.org_cmake_he > > > lp_support.html=CwIFAg=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQ > YWSI > > =qts7iZJBjQRtedrrcqcDRKGTou2a2ZKSs95InlFGa34=PrIOuKSVt- > ib8BwXCLUzX > > hcXKOaI-nPRE3lR3m- > XYH8=g65Y7hDTwOo3VrTo2tEH3SUkWkr98xxGzXD1HwzQYsw > > = CMake Consulting: > > https://urldefense.proofpoint.com/v2/url?u=http- > 3A__cmake.org_cmake_he > > > lp_consulting.html=CwIFAg=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLr > DQY > > WSI=qts7iZJBjQRtedrrcqcDRKGTou2a2ZKSs95InlFGa34=PrIOuKSVt- > ib8BwXCL > > UzXhcXKOaI-nPRE3lR3m-XYH8=Ldr318Ilc_hQg2SdaGdLBb- > iz_KqDMgeeUbtAMAodH > > U= CMake Training Courses: > > https://urldefense.proofpoint.com/v2/url?u=http- > 3A__cmake.org_cmake_he > > > lp_training.html=CwIFAg=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQ > YWS > > I=qts7iZJBjQRtedrrcqcDRKGTou2a2ZKSs95InlFGa34=PrIOuKSVt- > ib8BwXCLUz > > XhcXKOaI-nPRE3lR3m- > XYH8=QihVB4Y2sUhcmA1sx5eJiP5U6bAEPUiv0eWvBaxQCBM& > > e= > > > > Visit other Kitware open-source projects at > > https://urldefense.proofpoint.com/v2/url?u=http- > 3A__www.kitware.com_op > > > ensource_opensource.html=CwIFAg=IV_clAzoPDE253xZdHuilRgztyh_Ri > V3wU > > > rLrDQYWSI=qts7iZJBjQRtedrrcqcDRKGTou2a2ZKSs95InlFGa34=PrIOuKS > Vt-ib > > 8BwXCLUzXhcXKOaI-nPRE3lR3m- > XYH8=HS6ra4DuapPlznsB2bTbsvGRHWo1VqrLEC8W > > LkNuNE4= > > > > Follow this link to subscribe/unsubscribe: > > https://urldefense.proofpoint.com/v2/url?u=http-3A__public.kitware.com > > > _mailman_listinfo_cmake=CwIFAg=IV_clAzoPDE253xZdHuilRgztyh_RiV > 3wUrLrDQYWSI=qts7iZJBjQRtedrrcqcDRKGT
Re: [CMake] What is the best way to handle Boost dependencies in a package config file
> -Original Message- > From: Ruslan Baratov [mailto:ruslan_bara...@yahoo.com] > Sent: Wednesday, January 27, 2016 2:18 AM > To: Johnson, Matt (GE Healthcare) > Cc: cmake@cmake.org > Subject: Re: [CMake] What is the best way to handle Boost dependencies in > a package config file > > On 27-Jan-16 09:54, Johnson, Matt (GE Healthcare) wrote: > > I like package config files. I want to use more of them. However, I have a > dependency on boost. While boost has a Find module, it doesn't have a > package config file. I'm not going to be able to depend on the users of my > package building boost via cmake (also, is that still an active thing?). > > > > It seems like the best I could hope for is to generate the package config > > file, > then hack it up to deal with the boost stuff. Has anyone already solved this > problem or have any tips? I found this Hunter package manager > (https://urldefense.proofpoint.com/v2/url?u=https- > 3A__github.com_ruslo_hunter=CwIC- > g=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI=qts7iZJBjQRtedrrc > qcDRKGTou2a2ZKSs95InlFGa34=h5ntMfnYSIOG1mQp_twkUPunK5Nz0q9 > HBqa7Ld4B_hs=zi9sk8NwKokHEqrLyGA5a_yrRxLdHF9P7ID23wgrWPY= > ), but it seems a bit heavyweight when all I want is boost. > -- > > Also, I can't have my build system going out and downloading the packages > - they all have to come from an internal source. > > > Just for your information you can use "file://" links instead of regular > "https://urldefense.proofpoint.com/v2/url?u=http-3A__=CwIC- > g=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI=qts7iZJBjQRtedrrc > qcDRKGTou2a2ZKSs95InlFGa34=h5ntMfnYSIOG1mQp_twkUPunK5Nz0q9 > HBqa7Ld4B_hs=ts63TtZeGvflnLyyJ8pKESTjxabuzNCPmS0fGn_1L7E= " in > both hunter.cmake and HunterGate so there is no need to "go out" - you can > be completely offline. > > Ruslo Ruslo - thanks for that. I'm seriously going to look into Hunter more. From my cursory glance at it, it's a seriously impressive bit of cmake scripting. Can I ask you a few follow ups? 1. in the case of boost, what it is doing is using the find package module, then creating import targets based off the information. Correct? 2. If I require a newer version of boost than what is listed in the gate file, I'd need to update hunter.cmake and HunterGate, correct? 3. If I want to distribute my package to others, they too would need to use Hunter, correct? Since boost doesn't have a package config file in its distribution, the dependency targets (e.g. Boost::regex) wouldn't exist on their system) Any tips on this? Thanks again for your hard work on Hunter. I've done a bit of cmake to download and install some dependencies in the past. Yours is WAY nicer than what I came up with. Matt -- 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] What is the best way to handle Boost dependencies in a package config file
I like package config files. I want to use more of them. However, I have a dependency on boost. While boost has a Find module, it doesn't have a package config file. I'm not going to be able to depend on the users of my package building boost via cmake (also, is that still an active thing?). It seems like the best I could hope for is to generate the package config file, then hack it up to deal with the boost stuff. Has anyone already solved this problem or have any tips? I found this Hunter package manager (https://github.com/ruslo/hunter), but it seems a bit heavyweight when all I want is boost. Also, I can't have my build system going out and downloading the packages - they all have to come from an internal source. Thanks, Matt -- 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] Importing a static library, then adding dependencies. Should the dependencies be transitive? They aren't for me!
I'm using the Visual Studio 2013 generator and cmake 3.4.3. Example: add_library(NS::a_lib STATIC IMPORTED) set_target_properties(NS::a_lib PROPERTIES IMPORTED_LOCATION ${a_lib_location}) set_target_properties(NS::a_lib PROPERTIES INTERFACE_LINK_LIBRARIES "/path/to/a/another_lib.lib") set_target_properties(NS::a_lib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "an/include/dir") add_library(NS::b_lib STATIC IMPORTED) set_target_properties(NS::b_lib PROPERTIES IMPORTED_LOCATION ${b_lib_location}) add_dependencies(NS::b_lib NS::a_lib) add_executable(test_exe main.cpp) target_link_libraries(test_exe NS::b_lib) #I expect to pull in all of A's stuff too. Howver, it doesn't for me. Assume I have two libraries, A and B. A has some libraries that it links to. B depends on A. I add import targets for both A and B. I use add_dependencies to signal the B->A dependency. When I use target_link_libraries for an executable and only list B, should it auto pull in A and A's dependencies? For me, all I get is B. I don't get any of its dependencies. Nor do I get A's include directories. Am I doing something wrong or misunderstanding the usage of these functions? I've done a lot of googling and searching the mailing list. I do see a couple of bugs that revolved around this, but all of them seem to indicate that they are fixed and this is supported. Am I wrong? Do I have to manually set the INTERFACE_LINK_LIBRARIES of B? Thanks for your help! Matt -- 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