开发者

Making my program compile on both windows and linux, what should I do about libraries?

开发者 https://www.devze.com 2023-04-03 13:22 出处:网络
I\'m using CMake to generate my makefiles and VC solutions. I have my program running on linux just fine. I\'m using a bunch of libraries, e.g. Lua. On my linux computer I just link to them and make s

I'm using CMake to generate my makefiles and VC solutions. I have my program running on linux just fine. I'm using a bunch of libraries, e.g. Lua. On my linux computer I just link to them and make sure in include the headers. All of the .so files are in some standard place. On Windows though I'm not sure what to do. Should I just include the entire Lua project into my own repository and link to that instead? Do I install Lua to some standard place like c:\开发者_开发问答program files\lua5.1 and link to that? Something else?


Your libraries can be in any place, you just need to say - where are they.

Before running cmake set up pathes of all your extern libs with some .bat file:

set LIBRARYPATH =path\to\your\library\
set include=%include%;%LIBRARYPATH%\include
set lib=%lib%;%LIBRARYPATH%\lib

Start cmd, run this .bat and then cmake should find all


I would provide a configuration field/variable for ccmake that the user can or must specify.

The mark_as_advanced can be used to make a custom variable only appear in the advanced mode. This would be suitable if you have a standard path (as you have mostly on windows). Yet, it still let's the user specify the value if needed.

Or you can simply set a variable the with the 'set' command if you don't want it in advanced.

Just make sure you check if the users entered a valid value.

0

精彩评论

暂无评论...
验证码 换一张
取 消