[CMake] Find a library that matches a specific pattern
katie outram
katie.outram at gmail.com
Wed Nov 28 15:36:37 EST 2012
I have a build that depends on the output from another build. We can't
combine the code into one build due to other issues.
I need to get cmake to pass the values of the libraries I want to link
against. I have worked out a find script for my second build that
allows me to use the find_library command to pull the .lib file that I'm
looking for. However, I must force the user to specify the specific name
of the library and I need to avoid this and just be able to pick up the
value if the name passes validation and the version is any number since
ultimately this whole process will be automated and I don't want to have to
worry about specifying version numbers.
My first build creates a directory
- build
- win64
- VC10
- bin
- Release
- filea1231.1.1.1.lib
- fileb2341.1.1.1.lib
- filec3451.1.1.1.lib
For the second build I force the user to tell me the path of the build
directory (i.e. C:\build\win64\VC10\bin\Release and assign this to a value
of first_build_dir)
I then have a find script where I am trying to find the library (i.e.
filea1231.1.1.1)
set (file_name filea1231.1.1.1)
find_library(my_library
name ${file_name}
PATHS ${first_build_dir}
)
The problem I have is that the filea1231.1.1.1 might change for the next
build (i.e filea1231.1.1.2). There is only one file named filea so I'd
like to be able to search for filea*.lib no matter what the versioning
information contains.
I thought I needed to go down the path of using a string(regex
match([filea0-9]+\\.[0-9]\\.[0-9]\\.[0-9] file_name) however I can't figure
out how to make this work in my current situation.
I then went down the path of trying the file(strings filea*.lib
file_name) option but it returned my ${first_build_dir} path
I'm looking for suggestions on how to handle pulling the changing file name
within cmake for use at anytime.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20121128/8eeacef9/attachment.htm>
More information about the CMake
mailing list