Re: [CMake] compiling for both python2 and python3

2018-06-25 Thread Juan E. Sanchez
Hi, What happens if you call FindBoost once for python 2 and once for python 3? Between invocations you could copy the boost variables to python specific variants. FindBoost( . . . .) SET(Boost_LIBRARY_DIRS_PYTHON2 ${Boost_LIBRARY_DIRS}) FindBoost( . . . .) SET(Boost_LIBRARY_DIRS_PYTHON3 ${B

Re: [CMake] compiling for both python2 and python3

2018-06-24 Thread Alexander Bürger
Hi Isaiah, that's correct and basically the reason why I need to compile two different modules for python2 and python3. In addition, I assume that the python minor version does not change; with that, I get some help from the package manager. Cheers, Alexander Bürger MET Norway ​ -- Powered by

Re: [CMake] compiling for both python2 and python3

2018-06-24 Thread Alexander Bürger
Hello Juan, but there are also two boost-python versions required, one for python2 and one for python3. I think it is not a good idea to reimplement the FindBoost logic. Cheers, Alexander Bürger MET Norway ​ -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ a

Re: [CMake] compiling for both python2 and python3

2018-06-22 Thread Juan E. Sanchez
I use the same source files to compile by setting TARGET_INCLUDE_DIRECTORIES for two similar targets. The included Python.h provides the PY_MAJOR_VERSION macro to know if you are compiling for python 2 or 3. https://github.com/devsim/devsim/blob/master/src/pythonapi/CMakeLists.txt https://gi

Re: [CMake] compiling for both python2 and python3

2018-06-22 Thread Isaiah Norton
On Fri, Jun 22, 2018 at 4:36 AM Alexander Bürger wrote: > Hi, > > I am trying to find a good way to compile a python module for a c++ > library using boost-python for both python2 and python3 in the same > compilation. So far, The only solution I found for using > The headers CMake needs to find

Re: [CMake] compiling for both python2 and python3

2018-06-22 Thread Alexander Bürger
Hi, thanks, Petr, for the hint. I was not aware of the possibility to specify a binary directory, and I will investigate how that works. Cheers, Alexander Bürger MET Norway -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake

Re: [CMake] compiling for both python2 and python3

2018-06-22 Thread Petr Kmoch
Hi Alexander. No time for a full answer now, but a hint: it's possible to add_subdirectory() the same CMakeLists.txt multiple times, if you use a different binary dir each time. You can set some variables in the parent CMakeList and use them in the child one to generate slightly different projects

[CMake] compiling for both python2 and python3

2018-06-22 Thread Alexander Bürger
Hi, I am trying to find a good way to compile a python module for a c++ library using boost-python for both python2 and python3 in the same compilation. So far, The only solution I found for using FIND_PACKAGE(PythonInterp REQUIRED) FIND_PACKAGE(PythonLibs REQUIRED) FIND_PACKAGE(Boost REQUIRED CO