Skip to content

Commit

Permalink
Added CMake project for compiling and packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
muellermartin committed Jun 16, 2015
1 parent eb70c52 commit 368f1fb
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
25 changes: 25 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 2.8.11)

project(screenoff)

if(MINGW)
# Set compiler flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
endif()

# Create executable from source file(s)
add_executable(${CMAKE_PROJECT_NAME} screenoff.cpp)

install(TARGETS "${CMAKE_PROJECT_NAME}" RUNTIME DESTINATION ".")
install(FILES "README.md" "LICENSE" DESTINATION ".")

set(CPACK_GENERATOR "ZIP")
set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "1")
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")

# This must always be last!
include(CPack)
17 changes: 17 additions & 0 deletions cmake/Toolchain-x86_64-w64-mingw32.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Windows)

# which compilers to use for C and C++
SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)

# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH ~/mingw32)

# adjust the default behaviour of the FIND_XXX() commands:
# search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

0 comments on commit 368f1fb

Please sign in to comment.