Configure build flags. Setup version.h. Add install target.
authorhobbes1069 <hobbes1069@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 18 Dec 2015 03:40:19 +0000 (03:40 +0000)
committerhobbes1069 <hobbes1069@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 18 Dec 2015 03:40:19 +0000 (03:40 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2552 01035d8c-6547-0410-b346-abe4f91aad63

freebeacon/CMakeLists.txt
freebeacon/cmake/MinGW.cmake [new file with mode: 0644]

index dbb66575ff7f5077ad197ca1880b3c697e4c2e2e..66709bd7f2df7aa82c6ad984aba9a9f968b02298 100644 (file)
@@ -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 (file)
index 0000000..333c1dc
--- /dev/null
@@ -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()