CMakeLists.txt 1.78 KB
#Specify the version being used aswell as the language
cmake_minimum_required(VERSION 2.8)

#Name your project here
project(2netpbm)

#set the module directory
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}")

#build the executable in the binary directory on MS Visual Studio
if ( MSVC )
	SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${OUTPUT_DIRECTORY}")
	SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIRECTORY}")
	SET( LIBRARY_OUTPUT_DIRECTORY_DEBUG "${OUTPUT_DIRECTORY}")
	SET( LIBRARY_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIRECTORY}")
	add_definitions(-D_CRT_SECURE_NO_WARNINGS)
	add_definitions(-D_SCL_SECURE_NO_WARNINGS)
endif ( MSVC )

#find packages-----------------------------------
#find OpenCV
find_package(OpenCV REQUIRED)

#find the pthreads package
find_package(Threads)

#find the X11 package
find_package(X11)

#find the STIM library
find_package(STIM)

#find Boost for Unix-based file lists
if( CMAKE_COMPILER_IS_GNUCC )
	find_package(Boost COMPONENTS filesystem system)
	if(Boost_FOUND)
		add_definitions(-DBOOST_PRECOMPILED)
		include_directories(${Boost_INCLUDE_DIR})
	else(Boost_FOUND)
		message(FATAL_ERROR "HSIproc requires Boost::filesystem and Boost::system when using GCC")
	endif(Boost_FOUND)
endif( CMAKE_COMPILER_IS_GNUCC )

#set the STIM include directory (either user provided or downloaded)
include_directories(${STIM_INCLUDE_DIRS})

#Assign source files to the appropriate variables to easily associate them with executables
file(GLOB SRC_CPP "*.cpp")
file(GLOB SRC_H "*.h")

#create an executable file
add_executable(2netpbm
		${SRC_CPP}
		${SRC_H}
)

#set the link libraries
target_link_libraries(2netpbm
		${OpenCV_LIBS}
		${X11_LIBRARIES}
)

#copy data files to the binary directory
file(COPY data/skyrim.jpg DESTINATION .)
file(COPY data/galaxy.jpg DESTINATION .)