Re: [CMake] works when I build using XCode, but not with CMake makefile
Hi Mr Candy (I am still getting a heck out of cottoncandycoder, sorry :D ) 1) the way you do it, is not really the way cmake should be used AFAIK. > In my CMakeLists.txt file I included: > set( CMAKE_CXX_FLAGS "-L/Applications/MAMP/Library/lib -lmysqlclient > -lpthread -lz" ) > set( CMAKE_EXE_LINKER_FLAGS "-lmysqlclient -lpthread -lm -lz" ) change this to: #I assume you have something like this somewhere add_executable(my_exe_name SOURCES my_exe_name.???) #here comes the "magic" link_directories(/Applications/MAMP/Library/lib) target_link_libraries(mysqlclient pthread m z) In theory, if all those dependencies are available at cmake-invocation, this should emit compiler calls that produce your binary and link mysqlclient into it (by default with using RPATH, see the docs on this: https://cmake.org/cmake/help/v3.0/prop_tgt/MACOSX_RPATH.html#prop_tgt:MACOSX_RPATH ). Depending on whether you wanna distribute your binary and cannot be sure if (at build time) pthreads etc are available, there are cmake find modules for pthreads and libz (FindThreads, FindZLIB) which you can use. libm should come with the libc of the system AFAIK. I also just checked but up to cmake 3.5, there is no MYSQL Find module. Which is kinda sad as there is a FindPostgreSQL module. :( If there would be, you could use it in a (hopefully) platform independent way and not bother with finding the right paths to libmysqlclient. 2) The compiler flags you posted do not explain, why Xcode apparently sets the rpath inside the binary and your cmake script doesn't (haven't seen the full CMakeLists.txt of your project yet). I hope the above gets you going. @cmake developers: it would be nice to have more obvious pointers to cmake example projects like an example SDK or so. If there is, please let me know. I only found this: http://www.vtk.org/Wiki/CMake/Examples#Finding_Packages but that's tied to vtk. Best, peter On 09/06/2016 08:12 PM, Cotton Candy wrote: > Peter, > In XCode I have this list of "settings" that includes > "Other Linker Flags" that I have set to "-lmysqlclient -lpthread -lm -lz" > and > "Other C++ Flags" that I have set to "-L/Applications/MAMP/Library/lib > -lmysqlclient -lpthread -lz" > > Maybe these explain why things work when I build with XCode, but not with > CMake. > > > but when I run the make it always says it is ignoring these (e.g. "warning: > argument unused during compilation: '-L/Applications/MAMP/Library/lib'"). > > Thanks again for you help. > Aaron > > > > > > On Tue, Sep 6, 2016 at 2:20 PM, Peter Steinbach <steinb...@scionics.de> > wrote: > >> Aaron, >> >> it's about the way that you compile your binary and link libmysqlclient >> into it. I guess (@all: please correct me if I am wrong) as I don't know >> how you use cmake to build your libraries/binaries, that you don't set the >> rpath of libmysqlclient inside your binary. Doing so will ensure that the >> absolute path of libmysqlclient is stored into your binary, so that the >> runtime environment can pick it up and use (keeping fingers crossed that >> the path is still valid). The alternative to doing so, is linking against >> the static version of libmysqlclient (which comes at a cost on another >> front as well). >> >> Best, >> P >> > -- 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] works when I build using XCode, but not with CMake makefile
Aaron, it's about the way that you compile your binary and link libmysqlclient into it. I guess (@all: please correct me if I am wrong) as I don't know how you use cmake to build your libraries/binaries, that you don't set the rpath of libmysqlclient inside your binary. Doing so will ensure that the absolute path of libmysqlclient is stored into your binary, so that the runtime environment can pick it up and use (keeping fingers crossed that the path is still valid). The alternative to doing so, is linking against the static version of libmysqlclient (which comes at a cost on another front as well). Best, P -- 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] works when I build using XCode, but not with CMake makefile
Hi Mr. Cotton ;), is the location of libmysqlclient* available through DYLD_LIBRARY_PATH at runtime of your code? Best, P On 09/06/2016 10:56 AM, Cotton Candy wrote: Hi, I have a project that I originally coded up using XCode. It builds and runs just fine using XCode. Now I have tried to set up the same project using CMake to generate a makefile. The project builds 100% without any errors using 'make', but the resulting code doesn't work. I get error: dyld: Library not loaded: libmysqlclient.18.dylib Referenced from: /Users/schurger/tmp/test_CMake2/./skedmo-solver Reason: image not found Trace/BPT trap: 5 Any idea how it could build OK without any errors if there was a missing library? Thanks! Aaron -- 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] CUDA: COMPILE_DEFINITIONS not picked up
Karl, good question. The docs say that you supply OPTIONS to cuda_add_library, which are in turn handed over to cuda_wrap_srcs. the only chance I see is digging there. internally, both cuda_add_xxx create regular cmake targets. I am not sure why cmake doesn't accept subsequent set_target_properties calls on them. I cannot spare the time resources to dive into this further. Sorry! Maybe it's worthwhile to file a bug report and bring that to the attention of the FindCUDA.cmake author? Best, peter On 08/30/2016 11:02 AM, Karl Ljungkvist wrote: Peter, I use CMake 3.5.1 and 3.0.2, and this works the same with both. Thanks for your suggestions. It does indeed work if I define them explicitly like that, but the reason why I want to use something like COMPILE_DEFINITIONS is that we have a large library that has several targets with different setups (release and debug mode, for instance). Most of the library is regular C++ and there the COMPILE_DEFINITIONS propagates to all source files. Now I want it to propagate to any CUDA .cu files too. What would it take to FindCUDA respect COMPILE_DEFINITIONS too? Best, Karl On 2016-08-26 09:41, Peter Steinbach wrote: Hey Karl, just gave it another shot ... so I can confirm what you saw with cmake 3.3 (btw, what cmake version did you use?). I should try a more recent one to make sure as well. anyhow, there 2 global workarounds that you have at your disposal: 1) set(CUDA_NVCC_FLAGS "-Dfoo") needs to be called *BEFORE* any cuda_add_xxx according to `cmake --help-module FindCUDA` 2) add_definitions(-Dfoo), I called it before cuda_add_xxx too and it worked as well Hope that get's you going - P -- 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] How to add -fPIC to a static library?
AFAIK, there is also a global CMAKE_POSITION_INDEPENDENT_CODE that is used to derive the target-specific value of POSITION_INDEPENDENT_CODE. If you wanna use fPIC for all your targets, you may wanna consider set(CMAKE_POSITION_INDEPENDENT_CODE ON). Best, P -- 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] CUDA: COMPILE_DEFINITIONS not picked up
Hey Karl, just gave it another shot ... so I can confirm what you saw with cmake 3.3 (btw, what cmake version did you use?). I should try a more recent one to make sure as well. anyhow, there 2 global workarounds that you have at your disposal: 1) set(CUDA_NVCC_FLAGS "-Dfoo") needs to be called *BEFORE* any cuda_add_xxx according to `cmake --help-module FindCUDA` 2) add_definitions(-Dfoo), I called it before cuda_add_xxx too and it worked as well Hope that get's you going - P -- 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] CUDA: COMPILE_DEFINITIONS not picked up
Hi Karl, just a quick question, why not use add_definitions? Did you look into it or is directory-wide preprocessor defines a nogo in your use case? Best, Peter -- 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] Fwd: Re: cmake needs 2 runs to find boost
Hi to all, {sorry for the email mess, anyway here is my to answer to Andreas as it affects this mail thread) thanks for the Boost_DEBUG hint. The output is much more concise and digestible than "--trace". Good News: It works now. I discovered I had a cmake Windows build installed on the machine that the MSYS2 terminal picked up. Once that was removed and I used the msys internal cmake, it works out nicely. However, the MSVS build target is gone now. So I have to find a way to use either version in parallel somehow. Bad News: I didn't follow through why the problem occurred in the first place. Once thing is for sure, the FindBoost module acutally triggered BOOST_FOUND=1! But finding the actual libraries of boost failed. Best, Peter On Thursday, November 05, 2015 05:29:16 PM Peter Steinbach wrote: > -- Forwarded Message -- > > Subject: Re: [CMake] cmake needs 2 runs to find boost > Date: Thursday, November 05, 2015, 04:41:51 PM > From: Andreas Naumann <andreas-naum...@gmx.net> > To: Peter Steinbach <steinb...@scionics.de> > > Hey Peter, > > It is not a solution, but I would set Boost_DEBUG to ON and compare the > output of the first and the second cmake run. > > Andreas > > Am 05.11.2015 um 14:26 schrieb Peter Steinbach: > > Hi to all, > > > > ok, I tried the attached minimal CMakeLists.txt again and found out that > > it > > fails in the way I described only with the "MSYS Makefiles" generator. If > > I > > use the same CMakeLists.txt without a custom generator (so MSVS is the > > default > > > IIRC), the libraries are found alright! > > > > Any ideas? > > Best, > > Peter > > > > On Thursday, November 05, 2015 01:41:33 PM Peter Steinbach wrote: > >> Hi Benedikt, > >> > >> interesting thought, however I wonder why cmake is then capable of > >> deducing > >> the right boost version and include path. Just inside the first error > >> message, I see: > >> > >> (x86)/CMake/share/cmake-3.2/Modules/FindBoost.cmake:1182 (message): > >>>> Unable to find the requested Boost libraries. > >>>> > >>>> Boost version: 1.57.0 > >>>> > >>>> Boost include path: C:/msys64/mingw64/include > >>>> > >>>> Could not find the following static Boost libraries: > >>>> boost_filesystem > >>>> boost_system > >> > >> strange, isn't it? > >> Peter > >> > >> On Thursday, November 05, 2015 11:41:10 AM Benedikt Hegner wrote: > >>> Hi Peter, > >>> > >>> as I don't use windows at all, this is just a very wild guess... > >>> > >>> Could it be that in the second run you actually don't use > >>> > >>> /CMake/share/cmake-3.2/Modules/FindBoost.cmake > >>> > >>> but boost-config.cmake, which it now finds in the cached environment of > >>> the first run? > >>> > >>> This assumes of course that you built boost w/ CMake and not bjam... > >>> > >>> Cheers, > >>> > >>> Benedikt > >>> > >>> On 03.11.2015 14:10, Peter Steinbach wrote: > >>>> Hi to all, > >>>> > >>>> I tested this with cmake 3.2.2 and 3.3.2 and still get the same > >>>> problem. > >>>> I'd like to use boost with gcc on windows 7 64bit. I installed boost > >>>> and > >>>> gcc with msys2 as I cannot use MSVC for the actual project I am looking > >>>> into for this. > >>>> > >>>> the funny thing, if I use the attached CMakeLists.txt on the machine > >>>> and > >>>> call: ``` > >>>> $ cmake -G "MSYS Makefiles" -DBOOST_ROOT=C:/msys64/mingw64 - > >>>> DBOOST_LIBRARYDIR==C:/msys64/mingw64/lib .. > >>>> -- The CXX compiler identification is GNU 4.9.2 > >>>> -- Check for working CXX compiler: C:/msys64/usr/bin/g++.exe > >>>> -- Check for working CXX compiler: C:/msys64/usr/bin/g++.exe -- works > >>>> -- Detecting CXX compiler ABI info > >>>> -- Detecting CXX compiler ABI info - done > >>>> -- Detecting CXX compile features > >>>> -- Detecting CXX compile features - done > >>>> setting win specific stuff > >>>> CMake Error at C:/Program Files > >>>> > >>>> (x86)/CMake/share
Re: [CMake] cmake needs 2 runs to find boost
I guess, nobody has a hint on what to look at or what to try? Best, Peter On Tuesday, November 03, 2015 02:10:54 PM Peter Steinbach wrote: > Hi to all, > > I tested this with cmake 3.2.2 and 3.3.2 and still get the same problem. > I'd like to use boost with gcc on windows 7 64bit. I installed boost and gcc > with msys2 as I cannot use MSVC for the actual project I am looking into > for this. > > the funny thing, if I use the attached CMakeLists.txt on the machine and > call: ``` > $ cmake -G "MSYS Makefiles" -DBOOST_ROOT=C:/msys64/mingw64 - > DBOOST_LIBRARYDIR==C:/msys64/mingw64/lib .. > -- The CXX compiler identification is GNU 4.9.2 > -- Check for working CXX compiler: C:/msys64/usr/bin/g++.exe > -- Check for working CXX compiler: C:/msys64/usr/bin/g++.exe -- works > -- Detecting CXX compiler ABI info > -- Detecting CXX compiler ABI info - done > -- Detecting CXX compile features > -- Detecting CXX compile features - done > setting win specific stuff > CMake Error at C:/Program Files > (x86)/CMake/share/cmake-3.2/Modules/FindBoost.cmake:1182 (message): > Unable to find the requested Boost libraries. > > Boost version: 1.57.0 > > Boost include path: C:/msys64/mingw64/include > > Could not find the following static Boost libraries: > > boost_filesystem > boost_system > > No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to > the directory containing Boost libraries or BOOST_ROOT to the location of > Boost. > Call Stack (most recent call first): > CMakeLists.txt:17 (FIND_PACKAGE) > > > CMake Error at CMakeLists.txt:24 (MESSAGE): > Boost not found (C:/msys64/mingw64) > > > -- Configuring incomplete, errors occurred! > See also > "C:/msys64/home/steinbac/development/cmake_sandbox/find_boost/build/CMakeFil > es/CMakeOutput.log". $ cmake -G "MSYS Makefiles" > -DBOOST_ROOT=C:/msys64/mingw64 - > DBOOST_LIBRARYDIR==C:/msys64/mingw64/lib .. > setting win specific stuff > Boost 1.57 found __ > -- Configuring done > -- Generating done > -- Build files have been written to: > C:/msys64/home/steinbac/development/cmake_sandbox/find_boost/build > ``` > > I'd like to link statically to multithreaded libboost_*-mt.a from my app. > But it proofes really hard to find Boost in the first place. > Any ideas? > > Peter -- Peter Steinbach, Dr. rer. nat. HPC Developer Scionics Computer Innovation GmbH Löscherstr. 16 01309 Dresden fon: +49 351 210 2882 fax: +49 351 210 1689 http://www.scionics.de Sitz der Gesellschaft: Dresden (Main office) Amtsgericht - Registergericht: Dresden HRB 20337 (Commercial Registry) Ust-IdNr.: DE813263791 (VAT ID Number) Geschäftsführer: John Duperon, Jeff Oegema (Managing Directors) -- 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] cmake needs 2 runs to find boost
Hi Benedikt, interesting thought, however I wonder why cmake is then capable of deducing the right boost version and include path. Just inside the first error message, I see: (x86)/CMake/share/cmake-3.2/Modules/FindBoost.cmake:1182 (message): > >Unable to find the requested Boost libraries. > > > >Boost version: 1.57.0 > > > >Boost include path: C:/msys64/mingw64/include > > > >Could not find the following static Boost libraries: > >boost_filesystem > >boost_system strange, isn't it? Peter On Thursday, November 05, 2015 11:41:10 AM Benedikt Hegner wrote: > Hi Peter, > > as I don't use windows at all, this is just a very wild guess... > > Could it be that in the second run you actually don't use >/CMake/share/cmake-3.2/Modules/FindBoost.cmake > but boost-config.cmake, which it now finds in the cached environment of > the first run? > > This assumes of course that you built boost w/ CMake and not bjam... > > Cheers, >Benedikt > > On 03.11.2015 14:10, Peter Steinbach wrote: > > Hi to all, > > > > I tested this with cmake 3.2.2 and 3.3.2 and still get the same problem. > > I'd like to use boost with gcc on windows 7 64bit. I installed boost and > > gcc with msys2 as I cannot use MSVC for the actual project I am looking > > into for this. > > > > the funny thing, if I use the attached CMakeLists.txt on the machine and > > call: ``` > > $ cmake -G "MSYS Makefiles" -DBOOST_ROOT=C:/msys64/mingw64 - > > DBOOST_LIBRARYDIR==C:/msys64/mingw64/lib .. > > -- The CXX compiler identification is GNU 4.9.2 > > -- Check for working CXX compiler: C:/msys64/usr/bin/g++.exe > > -- Check for working CXX compiler: C:/msys64/usr/bin/g++.exe -- works > > -- Detecting CXX compiler ABI info > > -- Detecting CXX compiler ABI info - done > > -- Detecting CXX compile features > > -- Detecting CXX compile features - done > > setting win specific stuff > > CMake Error at C:/Program Files > > > > (x86)/CMake/share/cmake-3.2/Modules/FindBoost.cmake:1182 (message): > >Unable to find the requested Boost libraries. > > > >Boost version: 1.57.0 > > > >Boost include path: C:/msys64/mingw64/include > > > >Could not find the following static Boost libraries: > >boost_filesystem > >boost_system > > > >No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to > >the > >directory containing Boost libraries or BOOST_ROOT to the location of > >Boost. > > > > Call Stack (most recent call first): > >CMakeLists.txt:17 (FIND_PACKAGE) > > > > CMake Error at CMakeLists.txt:24 (MESSAGE): > >Boost not found (C:/msys64/mingw64) > > > > -- Configuring incomplete, errors occurred! > > See also > > "C:/msys64/home/steinbac/development/cmake_sandbox/find_boost/build/CMakeF > > iles/CMakeOutput.log". $ cmake -G "MSYS Makefiles" > > -DBOOST_ROOT=C:/msys64/mingw64 - > > DBOOST_LIBRARYDIR==C:/msys64/mingw64/lib .. > > setting win specific stuff > > Boost 1.57 found __ > > -- Configuring done > > -- Generating done > > -- Build files have been written to: > > C:/msys64/home/steinbac/development/cmake_sandbox/find_boost/build > > ``` > > > > I'd like to link statically to multithreaded libboost_*-mt.a from my app. > > But it proofes really hard to find Boost in the first place. > > Any ideas? > > > > Peter -- Peter Steinbach, Dr. rer. nat. HPC Developer Scionics Computer Innovation GmbH Löscherstr. 16 01309 Dresden fon: +49 351 210 2882 fax: +49 351 210 1689 http://www.scionics.de Sitz der Gesellschaft: Dresden (Main office) Amtsgericht - Registergericht: Dresden HRB 20337 (Commercial Registry) Ust-IdNr.: DE813263791 (VAT ID Number) Geschäftsführer: John Duperon, Jeff Oegema (Managing Directors) -- 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] Fwd: Re: cmake needs 2 runs to find boost
-- Forwarded Message -- Subject: Re: [CMake] cmake needs 2 runs to find boost Date: Thursday, November 05, 2015, 04:41:51 PM From: Andreas Naumann <andreas-naum...@gmx.net> To: Peter Steinbach <steinb...@scionics.de> Hey Peter, It is not a solution, but I would set Boost_DEBUG to ON and compare the output of the first and the second cmake run. Andreas Am 05.11.2015 um 14:26 schrieb Peter Steinbach: > Hi to all, > > ok, I tried the attached minimal CMakeLists.txt again and found out that it > fails in the way I described only with the "MSYS Makefiles" generator. If I > use the same CMakeLists.txt without a custom generator (so MSVS is the default > IIRC), the libraries are found alright! > > Any ideas? > Best, > Peter > > On Thursday, November 05, 2015 01:41:33 PM Peter Steinbach wrote: >> Hi Benedikt, >> >> interesting thought, however I wonder why cmake is then capable of deducing >> the right boost version and include path. Just inside the first error >> message, I see: >> >> (x86)/CMake/share/cmake-3.2/Modules/FindBoost.cmake:1182 (message): >>>> Unable to find the requested Boost libraries. >>>> >>>> Boost version: 1.57.0 >>>> >>>> Boost include path: C:/msys64/mingw64/include >>>> >>>> Could not find the following static Boost libraries: >>>> boost_filesystem >>>> boost_system >> strange, isn't it? >> Peter >> >> On Thursday, November 05, 2015 11:41:10 AM Benedikt Hegner wrote: >>> Hi Peter, >>> >>> as I don't use windows at all, this is just a very wild guess... >>> >>> Could it be that in the second run you actually don't use >>> >>> /CMake/share/cmake-3.2/Modules/FindBoost.cmake >>> >>> but boost-config.cmake, which it now finds in the cached environment of >>> the first run? >>> >>> This assumes of course that you built boost w/ CMake and not bjam... >>> >>> Cheers, >>> >>> Benedikt >>> >>> On 03.11.2015 14:10, Peter Steinbach wrote: >>>> Hi to all, >>>> >>>> I tested this with cmake 3.2.2 and 3.3.2 and still get the same problem. >>>> I'd like to use boost with gcc on windows 7 64bit. I installed boost and >>>> gcc with msys2 as I cannot use MSVC for the actual project I am looking >>>> into for this. >>>> >>>> the funny thing, if I use the attached CMakeLists.txt on the machine and >>>> call: ``` >>>> $ cmake -G "MSYS Makefiles" -DBOOST_ROOT=C:/msys64/mingw64 - >>>> DBOOST_LIBRARYDIR==C:/msys64/mingw64/lib .. >>>> -- The CXX compiler identification is GNU 4.9.2 >>>> -- Check for working CXX compiler: C:/msys64/usr/bin/g++.exe >>>> -- Check for working CXX compiler: C:/msys64/usr/bin/g++.exe -- works >>>> -- Detecting CXX compiler ABI info >>>> -- Detecting CXX compiler ABI info - done >>>> -- Detecting CXX compile features >>>> -- Detecting CXX compile features - done >>>> setting win specific stuff >>>> CMake Error at C:/Program Files >>>> >>>> (x86)/CMake/share/cmake-3.2/Modules/FindBoost.cmake:1182 (message): >>>> Unable to find the requested Boost libraries. >>>> >>>> Boost version: 1.57.0 >>>> >>>> Boost include path: C:/msys64/mingw64/include >>>> >>>> Could not find the following static Boost libraries: >>>> boost_filesystem >>>> boost_system >>>> >>>> No Boost libraries were found. You may need to set BOOST_LIBRARYDIR >>>> to >>>> the >>>> directory containing Boost libraries or BOOST_ROOT to the location of >>>> Boost. >>>> >>>> Call Stack (most recent call first): >>>> CMakeLists.txt:17 (FIND_PACKAGE) >>>> >>>> CMake Error at CMakeLists.txt:24 (MESSAGE): >>>> Boost not found (C:/msys64/mingw64) >>>> >>>> -- Configuring incomplete, errors occurred! >>>> See also >>>> "C:/msys64/home/steinbac/development/cmake_sandbox/find_boost/build/CMak >>>> eF >>>> iles/CMakeOutput.log". $ cmake -G "MSYS Makefiles" >>>> -DBOOST_ROOT=C:/msys64/mingw64 - >>>> DBOOST_LIBRARYDIR==C:/msys64/mingw64/lib .. &g
Re: [CMake] cmake needs 2 runs to find boost
Hi to all, ok, I tried the attached minimal CMakeLists.txt again and found out that it fails in the way I described only with the "MSYS Makefiles" generator. If I use the same CMakeLists.txt without a custom generator (so MSVS is the default IIRC), the libraries are found alright! Any ideas? Best, Peter On Thursday, November 05, 2015 01:41:33 PM Peter Steinbach wrote: > Hi Benedikt, > > interesting thought, however I wonder why cmake is then capable of deducing > the right boost version and include path. Just inside the first error > message, I see: > > (x86)/CMake/share/cmake-3.2/Modules/FindBoost.cmake:1182 (message): > > >Unable to find the requested Boost libraries. > > > > > >Boost version: 1.57.0 > > > > > >Boost include path: C:/msys64/mingw64/include > > > > > >Could not find the following static Boost libraries: > > >boost_filesystem > > >boost_system > > strange, isn't it? > Peter > > On Thursday, November 05, 2015 11:41:10 AM Benedikt Hegner wrote: > > Hi Peter, > > > > as I don't use windows at all, this is just a very wild guess... > > > > Could it be that in the second run you actually don't use > > > >/CMake/share/cmake-3.2/Modules/FindBoost.cmake > > > > but boost-config.cmake, which it now finds in the cached environment of > > the first run? > > > > This assumes of course that you built boost w/ CMake and not bjam... > > > > Cheers, > > > >Benedikt > > > > On 03.11.2015 14:10, Peter Steinbach wrote: > > > Hi to all, > > > > > > I tested this with cmake 3.2.2 and 3.3.2 and still get the same problem. > > > I'd like to use boost with gcc on windows 7 64bit. I installed boost and > > > gcc with msys2 as I cannot use MSVC for the actual project I am looking > > > into for this. > > > > > > the funny thing, if I use the attached CMakeLists.txt on the machine and > > > call: ``` > > > $ cmake -G "MSYS Makefiles" -DBOOST_ROOT=C:/msys64/mingw64 - > > > DBOOST_LIBRARYDIR==C:/msys64/mingw64/lib .. > > > -- The CXX compiler identification is GNU 4.9.2 > > > -- Check for working CXX compiler: C:/msys64/usr/bin/g++.exe > > > -- Check for working CXX compiler: C:/msys64/usr/bin/g++.exe -- works > > > -- Detecting CXX compiler ABI info > > > -- Detecting CXX compiler ABI info - done > > > -- Detecting CXX compile features > > > -- Detecting CXX compile features - done > > > setting win specific stuff > > > CMake Error at C:/Program Files > > > > > > (x86)/CMake/share/cmake-3.2/Modules/FindBoost.cmake:1182 (message): > > >Unable to find the requested Boost libraries. > > > > > >Boost version: 1.57.0 > > > > > >Boost include path: C:/msys64/mingw64/include > > > > > >Could not find the following static Boost libraries: > > >boost_filesystem > > >boost_system > > > > > >No Boost libraries were found. You may need to set BOOST_LIBRARYDIR > > >to > > >the > > >directory containing Boost libraries or BOOST_ROOT to the location of > > >Boost. > > > > > > Call Stack (most recent call first): > > >CMakeLists.txt:17 (FIND_PACKAGE) > > > > > > CMake Error at CMakeLists.txt:24 (MESSAGE): > > >Boost not found (C:/msys64/mingw64) > > > > > > -- Configuring incomplete, errors occurred! > > > See also > > > "C:/msys64/home/steinbac/development/cmake_sandbox/find_boost/build/CMak > > > eF > > > iles/CMakeOutput.log". $ cmake -G "MSYS Makefiles" > > > -DBOOST_ROOT=C:/msys64/mingw64 - > > > DBOOST_LIBRARYDIR==C:/msys64/mingw64/lib .. > > > setting win specific stuff > > > Boost 1.57 found __ > > > -- Configuring done > > > -- Generating done > > > -- Build files have been written to: > > > C:/msys64/home/steinbac/development/cmake_sandbox/find_boost/build > > > ``` > > > > > > I'd like to link statically to multithreaded libboost_*-mt.a from my > > > app. > > > But it proofes really hard to find Boost in the first place. > > > Any ideas? > > > > > > Peter -- Peter Steinbach, Dr. rer. nat. HPC Developer Scionics Computer Innovation GmbH Löscherstr. 16 01309 Dresden fon: +49 351 210 2882 fax: +49 351 210 1689 http:/
[CMake] cmake needs 2 runs to find boost
Hi to all, I tested this with cmake 3.2.2 and 3.3.2 and still get the same problem. I'd like to use boost with gcc on windows 7 64bit. I installed boost and gcc with msys2 as I cannot use MSVC for the actual project I am looking into for this. the funny thing, if I use the attached CMakeLists.txt on the machine and call: ``` $ cmake -G "MSYS Makefiles" -DBOOST_ROOT=C:/msys64/mingw64 - DBOOST_LIBRARYDIR==C:/msys64/mingw64/lib .. -- The CXX compiler identification is GNU 4.9.2 -- Check for working CXX compiler: C:/msys64/usr/bin/g++.exe -- Check for working CXX compiler: C:/msys64/usr/bin/g++.exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done setting win specific stuff CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.2/Modules/FindBoost.cmake:1182 (message): Unable to find the requested Boost libraries. Boost version: 1.57.0 Boost include path: C:/msys64/mingw64/include Could not find the following static Boost libraries: boost_filesystem boost_system No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost. Call Stack (most recent call first): CMakeLists.txt:17 (FIND_PACKAGE) CMake Error at CMakeLists.txt:24 (MESSAGE): Boost not found (C:/msys64/mingw64) -- Configuring incomplete, errors occurred! See also "C:/msys64/home/steinbac/development/cmake_sandbox/find_boost/build/CMakeFiles/CMakeOutput.log". $ cmake -G "MSYS Makefiles" -DBOOST_ROOT=C:/msys64/mingw64 - DBOOST_LIBRARYDIR==C:/msys64/mingw64/lib .. setting win specific stuff Boost 1.57 found __ -- Configuring done -- Generating done -- Build files have been written to: C:/msys64/home/steinbac/development/cmake_sandbox/find_boost/build ``` I'd like to link statically to multithreaded libboost_*-mt.a from my app. But it proofes really hard to find Boost in the first place. Any ideas? Peter # cmake compatibility issues CMAKE_MINIMUM_REQUIRED(VERSION 2.8) # project name PROJECT(test CXX) IF(WIN32) MESSAGE("setting win specific stuff") set(Boost_USE_STATIC_LIBSON) set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME OFF) set(BOOST_ALL_DYN_LINK OFF) set(Boost_ADDITIONAL_VERSIONS "1.47" "1.47.0") #SET(BOOST_ROOT "C:\\msys64\\mingw64") #SET(BOOST_LIBRARYDIR "C:\\msys64\\mingw64\\lib") ENDIF() FIND_PACKAGE (Boost 1.42 QUIET COMPONENTS filesystem system REQUIRED) IF(Boost_FOUND) MESSAGE("Boost ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} found _${Boost_Libraries}_") ELSE() MESSAGE(FATAL_ERROR "Boost not found (${BOOST_ROOT})") IF(NOT EXISTS ${Boost_ROOT}) MESSAGE("... because ${BOOST_ROOT} does not exist") ENDIF() ENDIF() -- 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