diff --git a/.gitignore b/.gitignore index cc307d880..9c9e85581 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ cmake_install.cmake CMakeFiles/ CMakeCache.txt +config.h # Make Makefile diff --git a/CMakeLists.txt b/CMakeLists.txt index a9f8d1e13..7dc7a9743 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,10 +21,16 @@ cmake_minimum_required(VERSION 2.8) project(FreeRDP C) set(CMAKE_COLOR_MAKEFILE ON) +# Include cmake modules +include(CheckIncludeFiles) +include(CheckLibraryExists) +include(TestBigEndian) + # Include our extra modules set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/) include(AutoVersioning) +include(ConfigOptions) # Soname versioning - 0.0.0 since it is not being managed yet set(FREERDP_VERSION_MAJOR "0") @@ -38,16 +44,32 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() +# Include files +check_include_files(sys/param.h HAVE_SYS_PARAM_H) +check_include_files(sys/socket.h HAVE_SYS_SOCKET_H) +check_include_files(netdb.h HAVE_NETDB_H) +check_include_files(fcntl.h HAVE_FCNTL_H) + +# Endian +test_big_endian(BIG_ENDIAN) + # Path to put keymaps set(FREERDP_KEYMAP_PATH "${CMAKE_INSTALL_PREFIX}/freerdp/keymaps") +# Include directories +include_directories(${CMAKE_SOURCE_DIR}) +include_directories(${CMAKE_SOURCE_DIR}/include) + +# Configure files +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) + # Build CUnit find_package(CUnit) if(CUNIT_FOUND) add_subdirectory(cunit) endif() -# Libraries +# Sub-directories add_subdirectory(include) add_subdirectory(libfreerdp-asn1) add_subdirectory(libfreerdp-utils) diff --git a/cmake/ConfigOptions.cmake b/cmake/ConfigOptions.cmake new file mode 100644 index 000000000..0f3469b64 --- /dev/null +++ b/cmake/ConfigOptions.cmake @@ -0,0 +1 @@ +option(WITH_DEBUG_TRANSPORT "Print transport debug message." OFF) diff --git a/config.h.in b/config.h.in new file mode 100644 index 000000000..204974a86 --- /dev/null +++ b/config.h.in @@ -0,0 +1,11 @@ +/* Include files */ +#cmakedefine HAVE_SYS_PARAM_H +#cmakedefine HAVE_SYS_SOCKET_H +#cmakedefine HAVE_NETDB_H +#cmakedefine HAVE_FCNTL_H + +/* Endian */ +#cmakedefine BIG_ENDIAN + +/* Options */ +#cmakedefine WITH_DEBUG_TRANSPORT diff --git a/cunit/CMakeLists.txt b/cunit/CMakeLists.txt index 757416e02..3c1ef1a04 100644 --- a/cunit/CMakeLists.txt +++ b/cunit/CMakeLists.txt @@ -19,8 +19,6 @@ include_directories(${CUNIT_INCLUDE_DIRS}) -include_directories(.) -include_directories(../include) include_directories(../libfreerdp-core) include_directories(../libfreerdp-gdi) diff --git a/freerdp-ui/test/CMakeLists.txt b/freerdp-ui/test/CMakeLists.txt index ad2275498..915fa9cd3 100644 --- a/freerdp-ui/test/CMakeLists.txt +++ b/freerdp-ui/test/CMakeLists.txt @@ -17,8 +17,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -include_directories(.) -include_directories(../../include) include_directories(../../libfreerdp-core) add_executable(freerdp-test diff --git a/libfreerdp-asn1/CMakeLists.txt b/libfreerdp-asn1/CMakeLists.txt index 000574489..2e9a87402 100644 --- a/libfreerdp-asn1/CMakeLists.txt +++ b/libfreerdp-asn1/CMakeLists.txt @@ -17,8 +17,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -include_directories(.) - set(COMMON_SRCS asn_application.h asn_codecs.h diff --git a/libfreerdp-core/CMakeLists.txt b/libfreerdp-core/CMakeLists.txt index 00d35b2b7..e6bb1a28a 100644 --- a/libfreerdp-core/CMakeLists.txt +++ b/libfreerdp-core/CMakeLists.txt @@ -17,10 +17,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -include_directories(.) -include_directories(../include) - -add_definitions(-DL_ENDIAN=1) add_definitions(-DEXT_PATH="/usr/lib/freerdp/extensions") set(LIBFREERDP_CORE_SRCS diff --git a/libfreerdp-gdi/CMakeLists.txt b/libfreerdp-gdi/CMakeLists.txt index 9933bf406..af6d295a1 100644 --- a/libfreerdp-gdi/CMakeLists.txt +++ b/libfreerdp-gdi/CMakeLists.txt @@ -17,9 +17,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -include_directories(.) -include_directories(../include) - set(FREERDP_GDI_SRCS color.c color.h diff --git a/libfreerdp-kbd/CMakeLists.txt b/libfreerdp-kbd/CMakeLists.txt index bf76b2988..ca7b00541 100644 --- a/libfreerdp-kbd/CMakeLists.txt +++ b/libfreerdp-kbd/CMakeLists.txt @@ -17,9 +17,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -include_directories(.) -include_directories(../include) - set(FREERDP_KBD_SRCS keyboard.h locales.c diff --git a/libfreerdp-utils/CMakeLists.txt b/libfreerdp-utils/CMakeLists.txt index f48ddff29..3f9c43310 100644 --- a/libfreerdp-utils/CMakeLists.txt +++ b/libfreerdp-utils/CMakeLists.txt @@ -17,9 +17,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -include_directories(.) -include_directories(../include) - set(FREERDP_UTILS_SRCS datablob.c hexdump.c