[CMake] How Can I compile the following code on Windows with CMake?

Philip Lowman philip at yhbt.com
Thu Apr 2 00:24:06 EDT 2009


On Mon, Mar 30, 2009 at 7:48 PM, Kermit Mei <kermit.mei at gmail.com> wrote:

> I want to add the following program as a part of my project, but I don't
> konw how to manage it in CMake.
>
> I worte the following in my CMakeLists.txt:
>  FIND_LIBRARY(LIBWMM winmm)
>  ADD_EXECUTABLE(aplay WIN32 aplay.c)
>  TARGET_LINK_LIBRARIES(aplay ${LIBWMM})
> But it always told me that "undefined reference to 'PlaySoundA at 12' ".
> How can I solve it?


Double check to make sure that winmm (and the MinGW implementation of this
library) has that function in it.  You might also consider asking for help
on a MinGW forum?


> By the way, what's the meaning of -mwindows? Can I also use strip in
> CMake for optimization?


This sounds like a MinGW thing.  If Google doesn't yield the answer you
should check with the MinGW mailing lists.  Also double check with make
VERBOSE=1 to make sure that you're actually passing -lwinmm and it's finding
the library.

It looks like CPack has an option to strip binaries.
http://www.cmake.org/Wiki/CMake:Packaging_With_CPack

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090402/8d9e7ec8/attachment.htm>


More information about the CMake mailing list