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 'playsou...@12' ".
How can I solve it?


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


Thanks.
Kermit 





------------------------------------------------------------------------------------------
// compiling with mingw: gcc -mwindows aplay.c -lwinmm -o aplay.exe
//                       strip aplay.exe

#include <windows.h>
#include <stdio.h>

int main(int argc, char* argv[]) {
  if (argc == 1) {
    printf ("%s <soundfile>\n", argv[0]);
    exit(0);
  }

  if (!PlaySound(argv[1], 0, SND_FILENAME)) {
    printf ("error playing file\n");
  }
  return 0;
}

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to