From d0335f089f5d5c2b1829d7cab0d1af0ec337e676 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Thu, 4 Jan 2024 18:21:21 +0900 Subject: [PATCH] cmake: fix CONFIG_HAVE_CXXINITIALIZE on macOS Note: This implementation is a bit more relaxed than what we do for non-cmake builds. Mainly because I'm not familiar enough with cmake to mirror what the non-cmake version does. --- arch/sim/src/sim/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/sim/src/sim/CMakeLists.txt b/arch/sim/src/sim/CMakeLists.txt index d7f5e2b12cb..9653f13db0b 100644 --- a/arch/sim/src/sim/CMakeLists.txt +++ b/arch/sim/src/sim/CMakeLists.txt @@ -140,6 +140,15 @@ list( sim_hosttime.c sim_hostuart.c) +# Note: sim_macho_init.c is picky about the place in the object list for +# linking. Namely, its constructor should be the first one in the executable. +# For now, we are just assuming no other files in HOSTSRCS provide constructors. +if(CONFIG_HOST_MACOS) + if(CONFIG_HAVE_CXXINITIALIZE) + list(APPEND HOSTSRCS sim_macho_init.c) + endif() +endif() + if(CONFIG_SIM_CAMERA_V4L2) list(APPEND HOSTSRCS sim_host_v4l2.c) list(APPEND SRCS sim_camera.c)