[CMake] cmake and dependencies

Tyler Roscoe tyler at cryptio.net
Fri Jul 24 11:19:12 EDT 2009


First of all, you ask strange questions and I still don't know what
you're trying to do. Have you read any tutorials or intros to CMake just
to get a general idea of what's going on?

On Fri, Jul 24, 2009 at 10:34:10AM +0200, schoappied wrote:
> Such a command, should it look something like this?
> 
> find_library(<VAR> libsndfile-1.dll [C:\Program Files\libsndfile])
> 
> What is <VAR> ? Should I give it a name, or leave it this way?

<VAR> is a variable (more specifically, a cache variable -- check the
docs if you don't know what that means). Put something in there, like
"my_sndfile". You can refer back to it later with ${my_sndfile}.

> You put this in CMakeLists right?

Yes, all CMake commands go in your CMakeLists.txt.

> When looking into the source (I'm not a developer) I find on this location:
> lmms\cmake\modules
> 
> these files. It looks like the files are meant for finding stuff
> 
> BuildPlugin.cmake
> ChecksForLibSamplerate.cmake
> DetectMachine.cmake
> FindAlsa.cmake
> FindOggVorbis.cmake
> FindPkgConfig.cmake
> FindPortaudio.cmake
> FindPulseAudio.cmake
> FindSTK.cmake
> InstallHelpers.cmake
> Win32Toolchain.cmake
> Win64Toolchain.cmake
> cmakefiles
> config-alsa.h.cmake

It looks like you're working with a project that has already been
converted to use CMake?

> Explored some more, to solve the issue:
> 
> First maybe this is interesting:
> 
> $ pkg-config --libs sndfile
> Package sndfile was not found in the pkg-config search path.
> Perhaps you should add the directory containing `sndfile.pc'
> to the PKG_CONFIG_PATH environment variable
> No package 'sndfile' found

I don't know what pkg-config is.

Have you tried doing what that error messsage suggests and modifying
your PKG_CONFIG_PATH environment variable?

> Besides that, I found a FindSndfile.cmake file on the internet (see 
> attachment)
> 
> I put it in lmms\cmake\modules
> 
> And added these entries in the cmake gui:
> 
> SNDFILE_INCLUDE_DIR               C:/Program 
> Files/Mega-Nerd/libsndfile/include
> SNDFILE_LIBRARY                         C:/Program 
> Files/Mega-Nerd/libsndfile

You'll need some kind of find_package (Sndfile) to make CMake run that
FindSndfile.cmake.

tyler


More information about the CMake mailing list