From 69227260282274f31e83a0f90d9eb00e17c277d5 Mon Sep 17 00:00:00 2001 From: hobbes1069 Date: Fri, 18 Dec 2015 03:40:19 +0000 Subject: [PATCH] Configure build flags. Setup version.h. Add install target. git-svn-id: https://svn.code.sf.net/p/freetel/code@2552 01035d8c-6547-0410-b346-abe4f91aad63 --- freebeacon/CMakeLists.txt | 11 +++++++++-- freebeacon/cmake/MinGW.cmake | 8 ++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 freebeacon/cmake/MinGW.cmake diff --git a/freebeacon/CMakeLists.txt b/freebeacon/CMakeLists.txt index dbb66575..66709bd7 100644 --- a/freebeacon/CMakeLists.txt +++ b/freebeacon/CMakeLists.txt @@ -41,7 +41,7 @@ else() set(FREEBEACON_VERSION_STRING "${FREEBEACON_VERSION}") endif() message(STATUS "freebeacon version: ${FREEBEACON_VERSION_STRING}") -#configure_file(cmake/version.h.in version.h @ONLY) +configure_file(cmake/version.h.in version.h @ONLY) # Set default build type if(NOT CMAKE_BUILD_TYPE) @@ -71,7 +71,12 @@ endif() # Set default build flags. -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fPIC -pie -Wl,-z,relro -Wl,-z,now") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pie -Wl,-z,relro -Wl,-z,now") + +# -fPIC is implied on MinGW... +if(NOT WIN32) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") +endif() # # Setup cmake options @@ -255,3 +260,5 @@ target_link_libraries(freebeacon ${FREEBEACON_LINK_LIBS}) if(FREEBEACON_STATIC_DEPS) add_dependencies(freebeacon ${FREEBEACON_STATIC_DEPS}) endif() + +install(TARGETS freebeacon RUNTIME DESTINATION bin) diff --git a/freebeacon/cmake/MinGW.cmake b/freebeacon/cmake/MinGW.cmake new file mode 100644 index 00000000..333c1dc0 --- /dev/null +++ b/freebeacon/cmake/MinGW.cmake @@ -0,0 +1,8 @@ +# If we're cross-compiling then we need to set the target host manually. +if(MINGW AND CMAKE_CROSSCOMPILING) + if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) + set(HOST x86_64-w64-mingw32) + else() + set(HOST i686-w64-mingw32) + endif() +endif() -- 2.25.1