openalbridge/CMakeLists.txt
author koda
Mon, 29 Jun 2009 23:03:25 +0000
changeset 2212 6b5da1a2765a
parent 2203 6bd39d75e0dd
child 2213 bd51bbf06033
permissions -rw-r--r--
-openalbridge headers cleaned -static building of lib for non MSVC compilers

find_package(OpenAL REQUIRED)
find_package(OggVorbis REQUIRED)
include_directories(${OPENAL_INCLUDE_DIR})
include_directories(${OGGVORBIS_INCLUDE_DIRS})

#set flag configuration for build type
set(CMAKE_C_FLAGS "-Wall -pipe")
set(CMAKE_C_FLAGS_RELEASE "-w -O2 -fomit-frame-pointer")
set(CMAKE_C_FLAGS_DEBUG "-O0 -g -DDEBUG")

#set destination directory for library
set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})

#list of source files for libraries
set(openal_src
	openalwrap.c loaders.c endianness.c wrappers.c
)

#build a static library for human systems
set (build_type STATIC)

#visualstudio doesn't like static linking, so we're building a shared library just for it
if(MSVC)
#workaround for visualstudio (wants headers in the source list)
	set(openal_src
		openalwrap.h loaders.h endianness.h wrappers.h winstdint.h globals.h ${openal_src}
	)
#deps for the shared library
	link_libraries(${OPENAL_LIBRARY})
	link_libraries(${OGG_LIBRARY})
	link_libraries(${VORBIS_LIBRARY})
	link_libraries(${VORBISFILE_LIBRARY})
#build a shared library
	set (build_type SHARED)
endif(MSVC)

#compiles and links actual library
add_library (openalbridge ${build_type} ${openal_src})

if(WIN32)
	SET_TARGET_PROPERTIES(openalbridge PROPERTIES LINK_FLAGS /DEF:openalbridge.def)
#install it in the executable directory
	install(TARGETS openalbridge DESTINATION bin)
endif(WIN32)