advice for resolving errors with CMake 3.8

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

advice for resolving errors with CMake 3.8

Michael Ellery
I generally develop on a latest cmake (provided by homebrew) and that works well for me. Unfortunately, I also need to support Visual Studio builds and it looks like the cmake that is bundled with VS is 3.8. I’m apparently using bleeding-edge features related to IMPORTED libraries, judging by these errors:

||   Cannot specify include directories for imported target “some_lib”.

||   add_library cannot create ALIAS target “NIH::some_lib" because target
||   “some_lib" is IMPORTED.

||   Cannot specify compile options for imported target “some_lib".
||

What is the recommended way to deal with include dirs and compile settings for IMPORTED targets with pre-3.11?

Thanks,
Mike


--

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:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: advice for resolving errors with CMake 3.8

Alan W. Irwin
On 2018-05-02 09:45-0700 Michael Ellery wrote:

> I generally develop on a latest cmake (provided by homebrew) and that works well for me. Unfortunately, I also need to support Visual Studio builds and it looks like the cmake that is bundled with VS is 3.8. I’m apparently using bleeding-edge features related to IMPORTED libraries, judging by these errors:
>
> ||   Cannot specify include directories for imported target “some_lib”.
>
> ||   add_library cannot create ALIAS target “NIH::some_lib" because target
> ||   “some_lib" is IMPORTED.
>
> ||   Cannot specify compile options for imported target “some_lib".
> ||
>
> What is the recommended way to deal with include dirs and compile settings for IMPORTED targets with pre-3.11?

Hi Michael:

Just in case nobody comes up with a simple solution for your question
about taking the backward step (in my opinion) of making your build
system compatible with CMake-3.8, have you tried to download and
install CMake version 3.11 from KitWare for Windows to see if that
works well for your VS platform?  (My guess is you would merely need
to change the PATH so that CMake version 3.11 rather than CMake
version 3.8 was used, but I don't have any VS experience so it might
be more complicated than that.) Anyhow, I thought this idea was worth
a shot since it allows you to stick with CMake-3.11 compatibility for
your build system.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________
--

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:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: advice for resolving errors with CMake 3.8

Michael Ellery

> On May 2, 2018, at 3:55 PM, Alan W. Irwin <[hidden email]> wrote:
>
> On 2018-05-02 09:45-0700 Michael Ellery wrote:
>
>> I generally develop on a latest cmake (provided by homebrew) and that works well for me. Unfortunately, I also need to support Visual Studio builds and it looks like the cmake that is bundled with VS is 3.8. I’m apparently using bleeding-edge features related to IMPORTED libraries, judging by these errors:
>>
>> ||   Cannot specify include directories for imported target “some_lib”.
>>
>> ||   add_library cannot create ALIAS target “NIH::some_lib" because target
>> ||   “some_lib" is IMPORTED.
>>
>> ||   Cannot specify compile options for imported target “some_lib".
>> ||
>>
>> What is the recommended way to deal with include dirs and compile settings for IMPORTED targets with pre-3.11?
>
> Hi Michael:
>
> Just in case nobody comes up with a simple solution for your question
> about taking the backward step (in my opinion) of making your build
> system compatible with CMake-3.8, have you tried to download and
> install CMake version 3.11 from KitWare for Windows to see if that
> works well for your VS platform?  (My guess is you would merely need
> to change the PATH so that CMake version 3.11 rather than CMake
> version 3.8 was used, but I don't have any VS experience so it might
> be more complicated than that.) Anyhow, I thought this idea was worth
> a shot since it allows you to stick with CMake-3.11 compatibility for
> your build system.
>
> Alan

HI Alan,

Thanks for your suggestion. I wish it were that easy, but the bundled VS CMake is pretty tightly coupled and you can’t easily replace it. I believe they also rely on one or two features they might have added or enabled in their build of cmake - so they are currently maintaining a divergent fork that hopefully will eventually get mainlined (?).

In the meantime, it looks like I just need to switch to set_target_properties for 3.8 instead of trying to use target_include_directories on an IMPORTED target. This seems to be working so far.

Thanks,
Mike

--

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:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: advice for resolving errors with CMake 3.8

Stephen McDowell
If you don't want to have to keep switching to Windows and back to test, the most reliable way to know with absolute certainty is to install CMake 3.8 on OSX and use that.

Fortunately building cmake is actually quite easy, you can even use the newer cmake from brew to configure the older one (use cmake to build cmake!).

Make sure you set CMAKE_INSTALL_PREFIX to somewhere you know about (e.g. /opt/cmake-3.8). When you need to test this project, update your path to point there

export PATH="/opt/cmake-3.8/bin:$PATH"

You need to run that export command for every terminal, or put it in your ~/.bashrc while developing this project.

If you don't set CMAKE_INSTAL_PREFIX, `make install` will put it in /usr/local by default which will make it more challenging to uninstall in the future when you want to use cmake 3.11 from brew. Putting it in /opt makes it so you can just delete that entire /opt/cmake-3.8 folder and/or comment out the export command in your ~/.bashrc (making sure to launch a new terminal and verify cmake --version after editing your ~/.bashrc).

--

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:
https://cmake.org/mailman/listinfo/cmake