mpw/CMakeLists.txt

82 lines
2.1 KiB
CMake
Raw Normal View History

2016-08-09 12:16:12 +00:00
cmake_minimum_required(VERSION 3.1)
2016-08-02 21:12:15 +00:00
project(mpw)
set (PROJECT_TYPE "CXX")
set (PROJECT_NAME "mpw")
2016-08-03 00:12:17 +00:00
# these are only effective as of CMake 3.1, apparently.
# Use c++14 for all C++ files, c99 for C files.
#
2016-08-02 21:12:15 +00:00
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_EXTENSIONS FALSE)
2016-08-03 00:12:17 +00:00
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED TRUE)
set(CMAKE_C_EXTENSIONS FALSE)
2016-08-12 23:49:58 +00:00
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
# Clang or AppleClang
2016-09-01 00:38:31 +00:00
add_compile_options(-g -Wall)
2016-08-12 23:49:58 +00:00
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
2016-11-04 19:49:10 +00:00
add_compile_options(-g -Wall -Wno-unknown-pragmas -Wno-multichar)
2016-08-12 23:49:58 +00:00
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
2016-08-02 21:12:15 +00:00
endif()
2016-11-06 18:48:53 +00:00
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
add_compile_options(-D _BSD_SOURCE)
ENDIF()
2016-09-01 00:38:31 +00:00
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_BINARY_DIR})
2016-08-12 23:49:58 +00:00
#
# create the config.h file.
#
INCLUDE (CheckIncludeFiles)
2016-08-12 23:49:58 +00:00
INCLUDE (CheckStructHasMember)
2016-11-06 18:48:53 +00:00
INCLUDE (CheckFunctionExists)
INCLUDE (CheckLibraryExists)
CHECK_INCLUDE_FILES(endian.h HAVE_ENDIAN_H)
CHECK_INCLUDE_FILES(sys/endian.h HAVE_SYS_ENDIAN_H)
CHECK_INCLUDE_FILES(machine/endian.h HAVE_MACHINE_ENDIAN_H)
2016-11-06 18:48:53 +00:00
CHECK_INCLUDE_FILES(bsd/string.h HAVE_BSD_STRING_H)
2016-08-12 23:49:58 +00:00
CHECK_STRUCT_HAS_MEMBER("struct dirent" d_namlen dirent.h HAVE_DIRENT_D_NAMLEN)
CHECK_STRUCT_HAS_MEMBER("struct stat" st_birthtime sys/stat.h HAVE_STAT_ST_BIRTHTIME)
2016-11-06 18:48:53 +00:00
set(CMAKE_REQUIRED_INCLUDES string.h)
CHECK_FUNCTION_EXISTS(strlcat HAVE_STRLCAT)
CHECK_FUNCTION_EXISTS(strlcpy HAVE_STRLCPY)
set(CMAKE_REQUIRED_INCLUDES)
CHECK_LIBRARY_EXISTS(edit readline "" HAVE_LIBEDIT)
CHECK_LIBRARY_EXISTS(readline readline "" HAVE_LIBREADLINE)
CHECK_LIBRARY_EXISTS(history add_history "" HAVE_LIBHISTORY)
# feature config
SET(ENABLE_DEBUGGER 1 CACHE BOOL "Define whether debugger should be enabled.")
IF(ENABLE_DEBUGGER)
ENDIF()
2016-08-09 15:56:25 +00:00
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h)
2016-08-02 21:12:15 +00:00
2013-02-06 04:41:11 +00:00
add_subdirectory(bin)
2013-02-07 04:44:12 +00:00
add_subdirectory(cpu)
2013-02-08 00:47:49 +00:00
add_subdirectory(toolbox)
2013-02-11 01:18:47 +00:00
add_subdirectory(mplite)
add_subdirectory(mpw)
2013-03-04 03:17:27 +00:00
add_subdirectory(macos)
2016-08-09 12:16:12 +00:00
add_subdirectory(cxx)
add_subdirectory(native)