| 1 |
# portmidi |
| 2 |
# Roger B. Dannenberg |
| 3 |
# 20 Sep 2009 |
| 4 |
|
| 5 |
cmake_minimum_required(VERSION 2.6) |
| 6 |
if(UNIX) |
| 7 |
# allow user to set Release or Debug |
| 8 |
set(CMAKE_BUILD_TYPE Release CACHE STRING |
| 9 |
"Semicolon-separate list of supported configuration types") |
| 10 |
# set default directories but don't override cached values... |
| 11 |
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CACHEFILE_DIR}/${CMAKE_BUILD_TYPE} |
| 12 |
CACHE STRING "libraries go here") |
| 13 |
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CACHEFILE_DIR}/${CMAKE_BUILD_TYPE} |
| 14 |
CACHE STRING "libraries go here") |
| 15 |
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY |
| 16 |
${CMAKE_CACHEFILE_DIR}/${CMAKE_BUILD_TYPE} |
| 17 |
CACHE STRING "executables go here") |
| 18 |
|
| 19 |
else(UNIX) |
| 20 |
# this does not seem to work for xcode: |
| 21 |
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING |
| 22 |
"Semicolon-separate list of supported configuration types") |
| 23 |
endif(UNIX) |
| 24 |
|
| 25 |
#set(CMAKE_RELATIVE_PATHS ON CACHE STRING "avoid absolute paths" FORCE) |
| 26 |
|
| 27 |
# Clear out the built-in C++ compiler and link flags for each of the |
| 28 |
# unused configurations. |
| 29 |
set(CMAKE_CXX_FLAGS_MINSIZEREL "" CACHE INTERNAL "Unused") |
| 30 |
set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "Unused") |
| 31 |
set(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "Unused") |
| 32 |
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "Unused") |
| 33 |
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "Unused") |
| 34 |
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "Unused") |
| 35 |
set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "Unused") |
| 36 |
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "Unused") |
| 37 |
|
| 38 |
set(CMAKE_OSX_ARCHITECTURES i386 x86_64 CACHE STRING "change to needed architecture for a smaller library" FORCE) |
| 39 |
|
| 40 |
PROJECT(portmidi) |
| 41 |
|
| 42 |
if(UNIX) |
| 43 |
# Problem: if there was an old Debug build and you change |
| 44 |
# CMAKE_BUILD_TYPE to Release, then the OUTPUT_DIRECTORY's will |
| 45 |
# still be Debug. Try to fix this by checking if the DIRECTORY's |
| 46 |
# look wrong, and if so, force them to the defaults: |
| 47 |
if(CMAKE_BUILD_TYPE MATCHES "Debug") |
| 48 |
set(BAD_DIR "Release") |
| 49 |
else(CMAKE_BUILD_TYPE MATCHES "Debug") |
| 50 |
set(BAD_DIR "Debug") |
| 51 |
endif(CMAKE_BUILD_TYPE MATCHES "Debug") |
| 52 |
# use library as reference -- if you give it a non-BAD_DIR location |
| 53 |
# then every other path is left alone |
| 54 |
if(CMAKE_LIBRARY_OUTPUT_DIRECTORY MATCHES ${BAD_DIR}) |
| 55 |
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY |
| 56 |
${CMAKE_CACHEFILE_DIR}/${CMAKE_BUILD_TYPE} |
| 57 |
CACHE STRING "executables go here" FORCE) |
| 58 |
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY |
| 59 |
${CMAKE_CACHEFILE_DIR}/${CMAKE_BUILD_TYPE} |
| 60 |
CACHE STRING "libraries go here" FORCE) |
| 61 |
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY |
| 62 |
${CMAKE_CACHEFILE_DIR}/${CMAKE_BUILD_TYPE} |
| 63 |
CACHE STRING "libraries go here" FORCE) |
| 64 |
endif(CMAKE_LIBRARY_OUTPUT_DIRECTORY MATCHES ${BAD_DIR}) |
| 65 |
endif(UNIX) |
| 66 |
|
| 67 |
include_directories(pm_common porttime) |
| 68 |
add_subdirectory(pm_common) |
| 69 |
|
| 70 |
add_subdirectory(pm_test) |
| 71 |
|
| 72 |
add_subdirectory(pm_dylib) |
| 73 |
|
| 74 |
# Cannot figure out how to make an xcode Java application with CMake |
| 75 |
add_subdirectory(pm_java) |
| 76 |
|