diff --git a/Cabal/src/Distribution/Simple/GHC/ImplInfo.hs b/Cabal/src/Distribution/Simple/GHC/ImplInfo.hs index ea95aac50e6..4e6229cdb17 100644 --- a/Cabal/src/Distribution/Simple/GHC/ImplInfo.hs +++ b/Cabal/src/Distribution/Simple/GHC/ImplInfo.hs @@ -46,6 +46,7 @@ data GhcImplInfo = GhcImplInfo , supportsDebugLevels :: Bool -- ^ supports numeric @-g@ levels , supportsPkgEnvFiles :: Bool -- ^ picks up @.ghc.environment@ files , flagWarnMissingHomeModules :: Bool -- ^ -Wmissing-home-modules is supported + , unitIdForExes :: Bool } getImplInfo :: Compiler -> GhcImplInfo @@ -74,6 +75,7 @@ ghcVersionImplInfo ver = GhcImplInfo , supportsDebugLevels = v >= [8,0] , supportsPkgEnvFiles = v >= [8,0,1,20160901] -- broken in 8.0.1, fixed in 8.0.2 , flagWarnMissingHomeModules = v >= [8,2] + , unitIdForExes = v >= [9,2] } where v = versionNumbers ver @@ -94,6 +96,7 @@ ghcjsVersionImplInfo _ghcjsver ghcver = GhcImplInfo , supportsDebugLevels = ghcv >= [8,0] , supportsPkgEnvFiles = ghcv >= [8,0,2] --TODO: check this works in ghcjs , flagWarnMissingHomeModules = ghcv >= [8,2] + , unitIdForExes = ghcv >= [9,2] } where ghcv = versionNumbers ghcver diff --git a/Cabal/src/Distribution/Simple/GHC/Internal.hs b/Cabal/src/Distribution/Simple/GHC/Internal.hs index 330803a157b..99584c00391 100644 --- a/Cabal/src/Distribution/Simple/GHC/Internal.hs +++ b/Cabal/src/Distribution/Simple/GHC/Internal.hs @@ -424,6 +424,7 @@ componentGhcOptions verbosity implInfo lbi bi clbi odir = ghcOptThisUnitId = case clbi of LibComponentLocalBuildInfo { componentCompatPackageKey = pk } -> toFlag pk + _ | not (unitIdForExes implInfo) -> mempty ExeComponentLocalBuildInfo { componentUnitId = uid } -> toFlag (unUnitId uid) TestComponentLocalBuildInfo { componentUnitId = uid }