I have a question related to CMake in MAC. I make sure that the executable program will link the framework and libraries correctly with the following codes:
link
You do not need all this hassle (at least with cmake 2.8.12).
This works fine:
target_link_libraries(program stdc++ "-framework Foundation" "-framework Cocoa" objc)
When CMake sees a link parameter starting with "-", it does not prepend "-l" and passes the argument as-is to the linker (/usr/bin/c++).
You need the quotes for frameworks so that CMake treats the two words as a single entry and does not add "-l" before "Foundation" for example.