Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple Cmake_Prefix_Paths

Tags:

cmake

On a project I develop on, we're using cmake to compile our service. Currently, we need to get data for Qt from 3 different locations and I'm curious if there's a way to run one cmake command over three separate ones.

What we currently use:

cmake -G "Visual Studio 12 2013" -DWITH_SERVER=1 -DCMAKE_PREFIX_PATH=C:\Qt\5.5\msvc2013\lib\cmake ..
cmake -G "Visual Studio 12 2013" -DWITH_SERVER=1 -DCMAKE_PREFIX_PATH=C:\protobuf\src ..
cmake -G "Visual Studio 12 2013" -DWITH_SERVER=1 -DCMAKE_PREFIX_PATH=C:\protobuf\cmake\build\Release ..

We've attempted to pass the same flag 3 times and separating the paths with : and ;, but none seem to work as expected.

like image 650
ZeldaZach Avatar asked Jul 07 '15 04:07

ZeldaZach


1 Answers

To provide multiple paths in the CMAKE_PREFIX_PATH variable you need to delimit each entry by ;(semicolon). So your command will look like:

cmake -DCMAKE_PREFIX_PATH="C:\Qt\5.5\msvc2013\lib\cmake;C:\protobuf\src;C:\protobuf\c‌​make\build\Release"

To check if everything alright with the provided paths you can use the following code in the cmake file:

foreach(path ${CMAKE_PREFIX_PATH})
  message("Path: " ${path})
endforeach(path)

It will print every path provided.

like image 177
ixSci Avatar answered Oct 16 '22 05:10

ixSci