install: Marking a FRAMEWORK after install() causes assertion failure
Assertion failed: (this->NamelinkMode == NamelinkModeNone), function GenerateScriptForConfig, file ../Source/cmInstallTargetGenerator.cxx, line 214.
Asserts in cmake-3.12.2 and cmake-3.13.3. Does not assert in cmake-3.9.3
If you call install(TARGETS foo ...)
on a target before calling set_target_properties(foo PROPERTIES FRAMEWORK TRUE)
, it triggers an assertion failure in cmake. You can workaround the issue by moving the call to install
after the call to set_target_properties
.
Reproducer:
$ touch t.cpp
$ cat CMakeLists.txt
cmake_minimum_required(VERSION 3.9)
add_library(sourcekitd SHARED t.cpp)
install(TARGETS sourcekitd
FRAMEWORK DESTINATION lib
LIBRARY DESTINATION lib)
set_target_properties(sourcekitd PROPERTIES
FRAMEWORK TRUE)
$ cmake .
-- The C compiler identification is AppleClang 10.0.0.10001145
-- The CXX compiler identification is AppleClang 10.0.0.10001145
-- Check for working C compiler: /Applications/Xcode/External/10A255/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode/External/10A255/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode/External/10A255/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode/External/10A255/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
Assertion failed: (this->NamelinkMode == NamelinkModeNone), function GenerateScriptForConfig, file ../Source/cmInstallTargetGenerator.cxx, line 214.
Abort trap: 6