Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • You could check for CMAKE_CROSSCOMPILING. See e.g. How to instruct CMake to use the build architecture compiler?. Commented May 24, 2016 at 11:27
  • Could you please add a CMake code example of how you are doing the "run a test executable"? Did you add it as add_custom_command(TARGET ... POST_BUILD ...) and/or with add_test()? I think in both case just putting a if (NOT CMAKE_CROSSCOMPILING)|endif() around this particular command should do the trick. Commented May 25, 2016 at 7:53
  • @Florian: In the top-level CMakeLists.txt there's just ADD_SUBDIRECTORY(UnitTests). Then in the directory there's ExternalProject_Add(GMockDownload GIT_REPOSITORY "https://github.com/google/googletest.git" ... which does the rest of the work. Yes, if (NOT CMAKE_CROSSCOMPILING) helps here. It seems two separate build dirs and launching cmake twice is the way. Not optimal, because I'm getting two Eclipse projects instead of merely two Build Configurations. Commented May 25, 2016 at 8:05