[CMake] Do not force TARGET_OS to be HOST_OS (#771)
author이한종/동작제어Lab(SR)/Engineer/삼성전자 <hanjoung.lee@samsung.com>
Wed, 18 Apr 2018 04:43:39 +0000 (13:43 +0900)
committer박세희/동작제어Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Wed, 18 Apr 2018 04:43:39 +0000 (13:43 +0900)
Currently TARGET_OS was always forced to be HOST_OS.
It have not been an issue since all OS we handle was linux, so far.
For the future, we should TARGET_OS is set to HOST_OS only if it is not given.

CMakeLists.txt

index d295b44..11e9b02 100644 (file)
@@ -18,6 +18,10 @@ if(NOT TARGET_ARCH OR "${TARGET_ARCH}" STREQUAL "")
   set(TARGET_ARCH "${HOST_ARCH}")
 endif()
 
+if(NOT DEFINED TARGET_OS)
+  set(TARGET_OS "${HOST_OS}")
+endif()
+
 if("${HOST_ARCH}" STREQUAL "x86_64")
   set(HOST_ARCH_BASE ${HOST_ARCH})
 elseif("${HOST_ARCH}" STREQUAL "armv7l")
@@ -41,8 +45,6 @@ else()
   set(BUILD_IS_NATIVE False)
 endif()
 
-set(TARGET_OS ${HOST_OS})
-
 # host & target platform name
 set(HOST_PLATFORM "${HOST_ARCH}-${HOST_OS}")
 set(TARGET_PLATFORM "${TARGET_ARCH}-${TARGET_OS}")