[CMake] PKG_CHECK_MODULES cppunit

Michael Bowerman michael.bowerman at gmail.com
Sat May 17 14:20:51 EDT 2008


Philip,

Thanks!  I actaully was trying that way.  But, changed it.  Stupid me.

I copied the linked script as-is and it worked.  It found the lib64 path,
with no problem.

The problem I was having before (that made me try the PKG_CONFIG) was caused
by not having the ENABLE_TESTING() macro in the top level CMakeLists.txt.
So, make test did nothing.

Thanks again for the fast help.

_bowerman

On Sat, May 17, 2008 at 9:58 AM, Philip Lowman <philip at yhbt.com> wrote:

> On Sat, May 17, 2008 at 10:28 AM, Michael Bowerman <
> michael.bowerman at gmail.com> wrote:
>
>> List,
>>
>> I am trying to use cppunit for my automated tests.  I have the project
>> compiling with autotools.  But, I am moving to cmake to build on windows
>> (while the project is still small-ish).
>>
>> So, is the proper way to look for CppUnit to use pkg_check_modules?
>
>
> Only if CppUnit is only meant to work only with the GCC compiler or you
> will only ever use the GCC compiler.  If there is a chance you'll want to
> compile your code with MSVC or some other compiler or you wish to contribute
> your find modules back to CMake you should consider using the find_library()
> and find_path() commands to locate the cppunit header files and library.
>
> This is usually fairly simple to do and most people encapsulate this
> activity in a Find* macro.  Looks like someone has already done some work to
> make a FindCppUnit macro but it never got cleaned up and checked into CMake.
>
> http://www.cmake.org/pipermail/cmake/2006-October/011446.html
>
> Just set your CMAKE_MODULE_PATH and call FIND_PACKAGE(CppUnit) and then
> react accordingly based on the cache variables it provides.  You should
> probably also take advantage of CPPUNIT_FOUND in determining if it's
> appropriate to build and link the test code.
>
> Depending on how many test executables you have, you may want to make a
> small macro wrapper that calls ADD_EXECUTABLE() then ADD_TEST() that way you
> can keep your CMake code to a minimum.
>
> --
> Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080517/f099a15c/attachment-0001.htm>


More information about the CMake mailing list