Fix if BUILD_SHARED_LIBS is OFF

The option() disrupts toolchain files.