diff --git a/CMakeLists.txt b/CMakeLists.txt index d3ebd47..cedab79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 2.6) # Set package properties -project(wiiuse) +project(WiiUse) ### # Set up options @@ -15,6 +15,7 @@ project(wiiuse) option(BUILD_EXAMPLE "Should we build the example app?" YES) option(BUILD_EXAMPLE_SDL "Should we build the SDL-based example app?" YES) +option(INSTALL_EXAMPLES "Should we install the example apps?" YES) ### # Perform build configuration of dependencies diff --git a/example-sdl/CMakeLists.txt b/example-sdl/CMakeLists.txt index 2dd6f9c..5173f7b 100644 --- a/example-sdl/CMakeLists.txt +++ b/example-sdl/CMakeLists.txt @@ -2,8 +2,13 @@ find_package(SDL) find_package(OpenGL) find_package(GLUT) -if(SDL_FOUND) +if(SDL_FOUND AND OPENGL_FOUND AND GLUT_FOUND) include_directories(../src ${SDL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIRS}) add_executable(example-sdl sdl.c) target_link_libraries(example-sdl wiiuse ${SDL_LIBRARY} ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES}) + + if(INSTALL_EXAMPLES) + install(TARGETS example-sdl + RUNTIME DESTINATION bin COMPONENT examples) + endif() endif() diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 28dcbbb..90a1c44 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,3 +1,8 @@ include_directories(../src) add_executable(example example.c) -target_link_libraries(example wiiuse) \ No newline at end of file +target_link_libraries(example wiiuse) + +if(INSTALL_EXAMPLES) + install(TARGETS example + RUNTIME DESTINATION bin COMPONENT examples) +endif() \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 67a4339..23461bb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -50,12 +50,20 @@ install(TARGETS RUNTIME DESTINATION bin + COMPONENT + runtime ARCHIVE DESTINATION lib + COMPONENT + development LIBRARY DESTINATION lib + COMPONENT + runtime PUBLIC_HEADER DESTINATION - include) + include + COMPONENT + development)