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)