Nothing is wrong with my CMakeLists.txt file. I have security software that was interfering with the correct functionality of MinGW64 on the PC where I saw this problem. When I switched to a PC without that security software, everything worked.