project(mbricks)
cmake_minimum_required(VERSION 2.6)
if (NOT LIBPROJECT)
	find_package(PIP REQUIRED)
endif ()
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${PIP_INCLUDES})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")

file(GLOB HDRS "*.h")
file(GLOB CPPS "*.cpp")
add_library(mbricks SHARED ${CPPS})
target_link_libraries(mbricks ${PIP_LIBRARY})
if (DEFINED LIB)
	set(LIB 1)
	if (${WIN32})
		find_package(MinGW REQUIRED)
		set(CMAKE_INSTALL_PREFIX ${MINGW_DIR})
		install(FILES ${HDRS} DESTINATION ${MINGW_INCLUDE})
		install(TARGETS mbricks DESTINATION ${MINGW_LIB})
	else ()
		set(CMAKE_INSTALL_PREFIX /usr)
		install(FILES ${HDRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
		install(TARGETS mbricks DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
	endif ()
else ()
	install(TARGETS mbricks DESTINATION bin)
endif ()
