Here's what I'm doing:
1) In my framework CMakeLists.txt file, I have the following:
IF (APPLE)
SET_TARGET_PROPERTIES( MyFramework PROPERTIES FRAMEWORK true)
SET_TARGET_PROPERTIES( MyFramework PROPERTIES
XCODE_ATTRIBUTE_INSTALL_PATH @executable_path/../Frameworks/ )
ENDIF (APPLE)
The second "set_target_properties" line configures the framework to
always be looked for in the application bundle in the Frameworks
sub-folder.
2) In my top-level CMakeLists.txt file, I add setup a unified binary
output directory:
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Bin)
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Bin )
SET (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Bin )
3) Then, in my applications' CMakeLists.txt file, I have the following:
IF (APPLE)
ADD_CUSTOM_COMMAND(
TARGET MyApp
POST_BUILD
COMMAND ${PYTHON_EXECUTABLE}
ARGS ${CMAKE_HOME_DIRECTORY}/CopyFramework.py
--binary ${PROJECT_BINARY_DIR}/Bin
--framework MyFramework.framework
--app MyApp.app
)
ENDIF (APPLE)
This calls out to my python script, which does the work of assembling
the src and dest paths, and actually copying the Framework.
The final trick is that since this is a Mac only thing, I can rely on
an Xcode environment variable within the Python script:
config= os.environ["CONFIGURATION"]
This allows me to assemble the complete path to the actual binary
locations of the framework and the app.
The one thing I wish was that there was a CMake variable that would
expand to the current Config within the context of the
ADD_CUSTOM_COMMAND... It'd be nice to not have to resort to using the
Xcode environment variable.
I ran into the same problem, however with svn
. I found that by installing El Capitan, Xcode was "uninstalled". I reinstalled Xcode from the App Store and then reinstalled Xcode Command Line Tools via Terminal with
xcode-select --install
After installation, my /Library/Developer/CommandLineTools/usr/bin
directory reappeared and svn
started working again.
Best Answer
The problem is that Xcode Command-line Tools needs to be updated.
Solution #1
Go back to your terminal and enter:
You'll then receive the following output:
You will then be prompted in a window to update Xcode Command Line tools. (which may take a while)
Open a new terminal window and your development tools should be returned.
Addition: With any major or semi-major update you'll need to update the command line tools in order to get them functioning properly again. Check Xcode with any update. This goes beyond Mojave...
After that restart your terminal
Alternatively, IF that fails, and it very well might.... you'll get a pop-up box saying "Software not found on server", see below!
Solution #2
and you hit
xcode-select --install
and it doesn't find the software, log into Apple Developer, and install it via webpage.Login or sign up here:
https://developer.apple.com/download/more/
Look for: "Command Line Tools for Xcode 12.x" in the list of downloads Then click the dmg and download.